@allons-y/course-kit 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/assets/scripts/deck.js +3 -34
- package/assets/scripts/email.js +5 -3
- package/assets/styles/base.css +59 -5
- package/assets/styles/print.css +8 -1
- package/components/practice/practice-worksheet.webc +1 -5
- package/components/site/course-now.webc +7 -0
- package/components/site/glossary.webc +0 -5
- package/components/site/instructor.webc +171 -8
- package/components/site/masthead.webc +11 -1
- package/components/site/nav-links.webc +16 -0
- package/components/site/schedule-overview.webc +196 -15
- package/components/site/schedule-weeks.webc +24 -51
- package/components/site/site-footer.webc +16 -2
- package/components/site/syllabus.webc +168 -15
- package/components/ui/codepen-embed.webc +2 -5
- package/components/ui/download-button.webc +3 -3
- package/examples/starter/_data/schedule.json +1 -1
- package/layouts/deck.webc +0 -4
- package/layouts/document.webc +2 -1
- package/layouts/lesson.webc +8 -12
- package/lib/check.js +5 -1
- package/lib/copy.js +3 -3
- package/lib/data/index.js +1 -1
- package/lib/data/read.js +16 -1
- package/lib/data/site.js +2 -1
- package/lib/filters.js +11 -8
- package/lib/lesson-materials.js +3 -2
- package/lib/pdf.js +7 -1
- package/lib/plugin.js +4 -1
- package/lib/postcss.js +3 -1
- package/package.json +4 -2
- package/schemas/course.schema.json +10 -0
- package/schemas/instructor.schema.json +8 -0
- package/schemas/worksheet.schema.json +6 -1
- package/assets/scripts/theme-restore.js +0 -17
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script webc:setup>
|
|
2
2
|
/**
|
|
3
|
-
* A download link with an icon. The label is the slot.
|
|
4
|
-
* @prop {string} url the file to download
|
|
3
|
+
* A download link with an icon. The label is the slot. With no file there is no link: a download button that points nowhere is not shown.
|
|
4
|
+
* @prop {string} url the file to download. Only a string counts: a prop that is not given can resolve to Eleventy's `url` filter, which would print as the function's source
|
|
5
5
|
*/
|
|
6
6
|
</script>
|
|
7
|
-
<a webc:root="override" :href="url" download>
|
|
7
|
+
<a webc:root="override" :href="typeof url === 'string' && url ? url : undefined" webc:if="typeof url === 'string' && url" download>
|
|
8
8
|
<svg aria-hidden="true" width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" class="download-icon">
|
|
9
9
|
<path d="M8 2v8" />
|
|
10
10
|
<path d="M4.5 7 8 10.5 11.5 7" />
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
"topics": ["Writing HTML", "Headings, lists and links"],
|
|
12
|
-
"readings": [{ "title": "MDN: HTML basics", "href": "https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/HTML_basics", "check": "3 questions, due by the next class" }],
|
|
12
|
+
"readings": [{ "title": "MDN: HTML basics", "href": "https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/HTML_basics", "check": "3 questions, due by the next class", "due": "2026-09-03" }],
|
|
13
13
|
"resources": []
|
|
14
14
|
},
|
|
15
15
|
{
|
package/layouts/deck.webc
CHANGED
|
@@ -11,9 +11,6 @@
|
|
|
11
11
|
|
|
12
12
|
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
|
|
13
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
14
|
<template webc:nokeep @raw="bundleFile('css', 'content/styles/deck.css', $data)"></template>
|
|
18
15
|
<style webc:keep @raw="getBundle('css')"></style>
|
|
19
16
|
</head>
|
|
@@ -30,7 +27,6 @@
|
|
|
30
27
|
<button type="button" data-prev :aria-label="$data.copy.deck.previousSlide">←</button>
|
|
31
28
|
<span data-count aria-live="polite">1 / 1</span>
|
|
32
29
|
<button type="button" data-next :aria-label="$data.copy.deck.nextSlide">→</button>
|
|
33
|
-
<button type="button" data-toggle-theme :aria-label="$data.copy.deck.cycleColorTheme">◑</button>
|
|
34
30
|
<button type="button" data-toggle-fullscreen aria-pressed="false" :aria-label="$data.copy.deck.toggleFullscreen" hidden>⛶</button>
|
|
35
31
|
</div>
|
|
36
32
|
|
package/layouts/document.webc
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
layout: "base"
|
|
3
3
|
---
|
|
4
4
|
<div class="doc-layout" :data-contents="toc(content) ? 'true' : 'false'">
|
|
5
|
+
<!-- The page comes first in the source, so its h1 is the first thing a screen reader reaches; the contents rail is placed beside or above it by the grid. -->
|
|
6
|
+
<article class="content-column" @raw="content"></article>
|
|
5
7
|
<div class="doc-contents" webc:if="toc(content)">
|
|
6
8
|
<p class="rail-label" id="doc-contents-label" @text="$data.copy.document.contents"></p>
|
|
7
9
|
<template webc:nokeep @raw="toc(content).replaceAll('"># ', '">').replace('<nav ', '<nav aria-labelledby="doc-contents-label" ')"></template>
|
|
8
10
|
</div>
|
|
9
|
-
<article class="content-column" @raw="content"></article>
|
|
10
11
|
</div>
|
package/layouts/lesson.webc
CHANGED
|
@@ -7,10 +7,6 @@ layout: "base"
|
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
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
10
|
<h1 @text="copy.lessonPlans"></h1>
|
|
15
11
|
<p @text="fill(copy.onePlanPerClass, { time: timeOfDay($data.schedule?.meetings?.time) })"></p>
|
|
16
12
|
<p webc:if="$data.collections.deck?.length" @raw="fill(copy.everyDeckInMeeting, { link: link('/slides/', copy.slideIndex) })"></p>
|
|
@@ -48,14 +44,14 @@ layout: "base"
|
|
|
48
44
|
<td webc:if="lesson.noClass" colspan="2" class="muted no-class" @text="fill(copy.noClass, { reason: lesson.noClass })"></td>
|
|
49
45
|
<template webc:else webc:nokeep>
|
|
50
46
|
<td>
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<
|
|
58
|
-
</
|
|
47
|
+
<ul class="lesson-links" role="list">
|
|
48
|
+
<li><a :href="`/lessons/week-${lesson.week}/day-${lesson.day}/`" @text="copy.lessonPlan"></a></li>
|
|
49
|
+
<template webc:nokeep webc:for="deck of ($data.collections.deck ?? []).filter((d) => d.data.week === lesson.week && d.data.day === lesson.day)">
|
|
50
|
+
<li><a :href="deck.url" @text="deck.data.addendum ? copy.addendum : copy.slides"></a></li>
|
|
51
|
+
<li><a :href="deckNotesUrl(deck.data.week, deck.data.day, deck.data.addendum === true)" @text="deck.data.addendum ? copy.addendumNotes : copy.notes"></a></li>
|
|
52
|
+
</template>
|
|
53
|
+
<li webc:for="assignment of assignmentsDue($data.collections.assignment, lesson, $data.lessons)"><span @text="copy.due"></span> <a :href="assignment.url" @text="assignment.title"></a> (<span @text="assignment.dueLabel"></span>)</li>
|
|
54
|
+
</ul>
|
|
59
55
|
</td>
|
|
60
56
|
<td>
|
|
61
57
|
<span webc:for="(topic, index) of lesson.topics" webc:nokeep>
|
package/lib/check.js
CHANGED
|
@@ -7,7 +7,7 @@ const OPTIONS = {
|
|
|
7
7
|
theme: null,
|
|
8
8
|
copy: null,
|
|
9
9
|
clientCopy: null,
|
|
10
|
-
institution: ["name", "timezone", "lms"],
|
|
10
|
+
institution: ["name", "timezone", "lms", "sourceUrl"],
|
|
11
11
|
site: ["description", "keywords", "language"],
|
|
12
12
|
lessons: ["segments", "defaultDays"],
|
|
13
13
|
demos: ["runtime", "dir"],
|
|
@@ -77,6 +77,10 @@ export function checkOptions(options = {}) {
|
|
|
77
77
|
throw new Error(`courseKit: \`institution.timezone\` is "${timeZone}", which is not a time zone name. Use one like "America/New_York".`);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
+
const sourceUrl = options.institution?.sourceUrl;
|
|
81
|
+
if (sourceUrl !== undefined && !/^https?:\/\/[^\s/]+\.[^\s]+$/.test(String(sourceUrl))) {
|
|
82
|
+
throw new Error(`courseKit: \`institution.sourceUrl\` is ${JSON.stringify(sourceUrl)}, but it must be a web address such as "https://github.com/your-org/your-course".`);
|
|
83
|
+
}
|
|
80
84
|
const checkMode = options.worksheets?.checkMode;
|
|
81
85
|
if (checkMode !== undefined && !["question", "end"].includes(checkMode)) {
|
|
82
86
|
throw new Error(`courseKit: \`worksheets.checkMode\` is "${checkMode}", but it must be "question" or "end".`);
|
package/lib/copy.js
CHANGED
|
@@ -105,7 +105,6 @@ export const COPY_DEFAULTS = {
|
|
|
105
105
|
noClass: "No class — {reason}",
|
|
106
106
|
substitution: "Runs a {weekday} schedule",
|
|
107
107
|
dueKeyLabel: "Key to due items",
|
|
108
|
-
graded: "graded",
|
|
109
108
|
notGraded: "not graded",
|
|
110
109
|
dueKindTest: "Test",
|
|
111
110
|
dueKindGraded: "Graded",
|
|
@@ -158,7 +157,6 @@ export const COPY_DEFAULTS = {
|
|
|
158
157
|
hint: "Space reveals · arrows move",
|
|
159
158
|
defShown: "Definition shown for {term}",
|
|
160
159
|
symbols: "Symbols",
|
|
161
|
-
glossary: "Glossary",
|
|
162
160
|
courseGlossary: "Course glossary",
|
|
163
161
|
slidesOnly: "Slides only",
|
|
164
162
|
finalExam: "Final exam",
|
|
@@ -185,6 +183,7 @@ export const COPY_DEFAULTS = {
|
|
|
185
183
|
learningOutcomes: "Learning outcomes",
|
|
186
184
|
uponCompletingThisCourse: "Upon completing this course students will be able to:",
|
|
187
185
|
additionalOutcomesInThis: "Additional outcomes in this section",
|
|
186
|
+
additionalOutcomes: "Additional outcomes",
|
|
188
187
|
text: "Text",
|
|
189
188
|
noTextIsRequired: "No text is required.",
|
|
190
189
|
required: "Required:",
|
|
@@ -333,6 +332,8 @@ export const COPY_DEFAULTS = {
|
|
|
333
332
|
sendMeAMessage: "Send me a message",
|
|
334
333
|
blog: "Blog",
|
|
335
334
|
instructor: "Instructor",
|
|
335
|
+
contact: "Contact",
|
|
336
|
+
blogUrl: "Blog: {url}",
|
|
336
337
|
},
|
|
337
338
|
codepenEmbed: {
|
|
338
339
|
theCode: "The code",
|
|
@@ -351,7 +352,6 @@ export const COPY_DEFAULTS = {
|
|
|
351
352
|
slides: "Slides",
|
|
352
353
|
previousSlide: "Previous slide",
|
|
353
354
|
nextSlide: "Next slide",
|
|
354
|
-
cycleColorTheme: "Cycle color theme",
|
|
355
355
|
toggleFullscreen: "Toggle fullscreen",
|
|
356
356
|
},
|
|
357
357
|
document: {
|
package/lib/data/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { courseDefines, readCourseData, readPackage } from "./read.js";
|
|
1
|
+
export { courseDefines, readCourseData, readPackage, withoutSchema } from "./read.js";
|
|
2
2
|
export { resolveTerm } from "./term.js";
|
|
3
3
|
export { buildGlossary } from "./glossary.js";
|
|
4
4
|
export { buildLessons, DEFAULT_DAYS, SEGMENTS } from "./lessons.js";
|
package/lib/data/read.js
CHANGED
|
@@ -7,7 +7,7 @@ import { join } from "node:path";
|
|
|
7
7
|
*/
|
|
8
8
|
const readJson = (file) => {
|
|
9
9
|
try {
|
|
10
|
-
return JSON.parse(readFileSync(file, "utf8"));
|
|
10
|
+
return withoutSchema(JSON.parse(readFileSync(file, "utf8")));
|
|
11
11
|
} catch (error) {
|
|
12
12
|
if (error.code === "ENOENT") return {};
|
|
13
13
|
if (error instanceof SyntaxError) throw new Error(`${file} could not be read as JSON. Check for a missing or extra comma, quote or bracket. (${error.message.replace(/\s+/g, " ")})`, { cause: error });
|
|
@@ -15,6 +15,21 @@ const readJson = (file) => {
|
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* A parsed data file without its top-level `$schema`: the key is for the editor that validates the file, and a template that loops over a data
|
|
20
|
+
* object (`scale`, `policies`) would otherwise print it as an entry.
|
|
21
|
+
* @param {unknown} data
|
|
22
|
+
* @returns {unknown}
|
|
23
|
+
*/
|
|
24
|
+
export const withoutSchema = (data) => {
|
|
25
|
+
if (data && typeof data === "object" && !Array.isArray(data) && "$schema" in data) {
|
|
26
|
+
const rest = { ...data };
|
|
27
|
+
delete rest.$schema;
|
|
28
|
+
return rest;
|
|
29
|
+
}
|
|
30
|
+
return data;
|
|
31
|
+
};
|
|
32
|
+
|
|
18
33
|
/**
|
|
19
34
|
* The course's authored data files.
|
|
20
35
|
* @param {string} [dataDir]
|
package/lib/data/site.js
CHANGED
|
@@ -35,7 +35,7 @@ const originSlug = () => {
|
|
|
35
35
|
/**
|
|
36
36
|
* Site-wide metadata, the global `site`. URL resolution reads the CONTEXT, URL
|
|
37
37
|
* and DEPLOY_PRIME_URL variables; see the README.
|
|
38
|
-
* @param {{ course: object, pkg?: object, institution?: { name?: string, timezone?: string, lms?: string }, site?: { description?: string, keywords?: string, language?: string }, env?: NodeJS.ProcessEnv }} data
|
|
38
|
+
* @param {{ course: object, pkg?: object, institution?: { name?: string, timezone?: string, lms?: string, sourceUrl?: string }, site?: { description?: string, keywords?: string, language?: string }, env?: NodeJS.ProcessEnv }} data
|
|
39
39
|
* @returns {object}
|
|
40
40
|
*/
|
|
41
41
|
export function resolveSite({ course, pkg = {}, institution = {}, site = {}, env = process.env }) {
|
|
@@ -59,6 +59,7 @@ export function resolveSite({ course, pkg = {}, institution = {}, site = {}, env
|
|
|
59
59
|
institution: name,
|
|
60
60
|
timezone: institution.timezone || "UTC",
|
|
61
61
|
lms: institution.lms ?? "Brightspace",
|
|
62
|
+
sourceUrl: institution.sourceUrl ?? "",
|
|
62
63
|
keywords: site.keywords ?? [name, course.code, course.name, "syllabus", "course schedule", "class resources"].filter(Boolean).join(", "),
|
|
63
64
|
url,
|
|
64
65
|
hostname,
|
package/lib/filters.js
CHANGED
|
@@ -96,10 +96,10 @@ const kindKey = (kind) => `dueKind${kind.charAt(0).toUpperCase()}${kind.slice(1)
|
|
|
96
96
|
export const dueKindLabel = (kind, copy = COPY_DEFAULTS) => copy.schedule[kindKey(kind)] ?? "";
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
* The key above the schedule: one entry per kind in use, in a fixed order, with its label and
|
|
99
|
+
* The key above the schedule: one entry per kind in use, in a fixed order, with its label and, for a kind that is not graded, the words that say so.
|
|
100
100
|
* @param {object[]} weeks `scheduleWeeks` output
|
|
101
101
|
* @param {typeof COPY_DEFAULTS} [copy]
|
|
102
|
-
* @returns {{ kind: string, label: string,
|
|
102
|
+
* @returns {{ kind: string, label: string, note: string }[]}
|
|
103
103
|
*/
|
|
104
104
|
export const dueKeyItems = (weeks, copy = COPY_DEFAULTS) => {
|
|
105
105
|
const present = new Set();
|
|
@@ -112,7 +112,7 @@ export const dueKeyItems = (weeks, copy = COPY_DEFAULTS) => {
|
|
|
112
112
|
}
|
|
113
113
|
return Object.entries(DUE_KINDS)
|
|
114
114
|
.filter(([kind]) => present.has(kind))
|
|
115
|
-
.map(([kind, { graded }]) => ({ kind, label: dueKindLabel(kind, copy),
|
|
115
|
+
.map(([kind, { graded }]) => ({ kind, label: dueKindLabel(kind, copy), note: graded ? "" : copy.schedule.notGraded }));
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
/**
|
|
@@ -384,18 +384,21 @@ export const courseDeadlines = (weeks, schedule, copy = COPY_DEFAULTS) => {
|
|
|
384
384
|
|
|
385
385
|
/**
|
|
386
386
|
* The schedule page's month links: one per calendar month that has a class
|
|
387
|
-
* meeting, in calendar order
|
|
388
|
-
*
|
|
389
|
-
*
|
|
387
|
+
* meeting, in calendar order. `week` is the first week holding a meeting of
|
|
388
|
+
* the month, where the link points, and `last` the last one; a week that
|
|
389
|
+
* spans two months is in both ranges. Dates are ISO strings, so the month is
|
|
390
|
+
* read in UTC and never shifts with the build machine's zone.
|
|
390
391
|
* @param {object[]} weeks `scheduleWeeks` output
|
|
391
|
-
* @returns {{name: string, week: number}[]}
|
|
392
|
+
* @returns {{name: string, week: number, last: number}[]}
|
|
392
393
|
*/
|
|
393
394
|
export const scheduleMonths = (weeks) => {
|
|
394
395
|
const months = new Map();
|
|
395
396
|
for (const { week, meetings } of weeks ?? []) {
|
|
396
397
|
for (const { iso } of meetings.filter((meeting) => !meeting.noClass)) {
|
|
397
398
|
const month = iso.slice(0, 7);
|
|
398
|
-
|
|
399
|
+
const entry = months.get(month);
|
|
400
|
+
if (!entry) months.set(month, { name: dateFormat(iso, { month: "long" }), week, last: week });
|
|
401
|
+
else entry.last = Math.max(entry.last, week);
|
|
399
402
|
}
|
|
400
403
|
}
|
|
401
404
|
return [...months.values()];
|
package/lib/lesson-materials.js
CHANGED
|
@@ -20,7 +20,7 @@ export const lessonDecks = (data) => decksFor(data.collections?.deck, data.lesso
|
|
|
20
20
|
* The "Materials & links" sections of a lesson-day page, in order, each ready
|
|
21
21
|
* for `<link-section>`. A section with nothing to list is left out, except
|
|
22
22
|
* the resources one, which says so.
|
|
23
|
-
* @param {object} data a lesson-day page's data: `lesson`, `lessons`, `lessonDemos`, `collections`
|
|
23
|
+
* @param {object} data a lesson-day page's data: `lesson`, `lessons`, `lessonDemos` (a list of `{ title, slug, description }`, which a course supplies; anything but a list is no demos), `collections`
|
|
24
24
|
* @returns {{ title: string, items: LinkItem[], empty?: string }[]}
|
|
25
25
|
*/
|
|
26
26
|
export function lessonMaterials(data) {
|
|
@@ -34,7 +34,8 @@ export function lessonMaterials(data) {
|
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
title: copy.demosFromThisMeeting,
|
|
37
|
-
|
|
37
|
+
// Eleventy hands a computed key the string "" while it scans the page's dependencies, so only a list counts.
|
|
38
|
+
items: (Array.isArray(data.lessonDemos) ? data.lessonDemos : []).map((demo) => ({ title: demo.title, href: `/demo/${demo.slug}/`, note: demo.description })),
|
|
38
39
|
},
|
|
39
40
|
{
|
|
40
41
|
title: copy.exercisesDue,
|
package/lib/pdf.js
CHANGED
|
@@ -23,6 +23,12 @@ const loadFooterData = ({ course, term, dataDir }) => {
|
|
|
23
23
|
return { course: course ?? data.course, term: term ?? resolveTerm(data) };
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* The page margins of the syllabus PDF. `print.css` sets the same margins in its `@page` rule: an @page margin outranks this option, and a
|
|
28
|
+
* smaller one put the text over the page footer, which prints in the bottom margin.
|
|
29
|
+
*/
|
|
30
|
+
export const PDF_MARGIN = { top: "0.4in", bottom: "0.45in", left: "0.5in", right: "0.5in" };
|
|
31
|
+
|
|
26
32
|
const MIME = {
|
|
27
33
|
".css": "text/css",
|
|
28
34
|
".html": "text/html; charset=utf-8",
|
|
@@ -122,7 +128,7 @@ export default function registerSyllabusPdf(config, { isProduction, timezone, ou
|
|
|
122
128
|
displayHeaderFooter: true,
|
|
123
129
|
headerTemplate: "<span></span>",
|
|
124
130
|
footerTemplate: `<div style="width: 100%; font-size: 7px; text-align: center; color: #666;">${fill(resolveCopy({ dataDir }).pdf.footer, { course: footerData.course.code, name: footerData.course.name, term: footerData.term.label, generated, version, page: '<span class="pageNumber"></span>', pages: '<span class="totalPages"></span>' })}</div>`,
|
|
125
|
-
margin:
|
|
131
|
+
margin: PDF_MARGIN,
|
|
126
132
|
});
|
|
127
133
|
await page.close();
|
|
128
134
|
process.stdout.write(`[syllabus-pdf] wrote ${outputPath.replace(root, "")}\n`);
|
package/lib/plugin.js
CHANGED
|
@@ -7,7 +7,7 @@ import dashly from "@allons-y/dashly";
|
|
|
7
7
|
import { registerAssets } from "./assets.js";
|
|
8
8
|
import registerBundles from "./bundles.js";
|
|
9
9
|
import { checkOptions, courseWarnings } from "./check.js";
|
|
10
|
-
import { buildGlossary, buildLessons, courseDefines, inlineFontFaces, readCourseData, readPackage, resolveAudience, resolvePdf, resolveSite, resolveTerm } from "./data/index.js";
|
|
10
|
+
import { buildGlossary, buildLessons, courseDefines, inlineFontFaces, readCourseData, readPackage, resolveAudience, resolvePdf, resolveSite, resolveTerm, withoutSchema } from "./data/index.js";
|
|
11
11
|
import { copyJson, copyReader, fill, plural, resolveCopy } from "./copy.js";
|
|
12
12
|
import registerExtensions from "./extensions.js";
|
|
13
13
|
import registerFilters from "./filters.js";
|
|
@@ -112,6 +112,9 @@ export default function courseKit(config, options = {}) {
|
|
|
112
112
|
config.addLayoutAlias("notes", "notes.webc");
|
|
113
113
|
config.addLayoutAlias("worksheet", "worksheet.webc");
|
|
114
114
|
|
|
115
|
+
// A data file's `$schema` is for the editor; a template that loops over `scale` or `policies` must not see it.
|
|
116
|
+
config.addDataExtension("json", { parser: (text) => withoutSchema(JSON.parse(text)) });
|
|
117
|
+
|
|
115
118
|
registerPlugins(config, { components });
|
|
116
119
|
registerBundles(config, { inputDir });
|
|
117
120
|
registerFilters(config);
|
package/lib/postcss.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
3
3
|
|
|
4
|
+
import advancedPreset from "cssnano-preset-advanced";
|
|
4
5
|
import postcss from "postcss";
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -25,8 +26,9 @@ export default function postcssConfig({ env = process.env.ELEVENTY_ENV ?? "devel
|
|
|
25
26
|
stage: 3,
|
|
26
27
|
},
|
|
27
28
|
cssnano: {
|
|
29
|
+
// The preset as an imported function, not its name: cssnano resolves a name against the installed package and warns (CSSNANO_INSTALLED_PRESET) that it is not using its built-in preset.
|
|
28
30
|
preset: [
|
|
29
|
-
|
|
31
|
+
advancedPreset,
|
|
30
32
|
{
|
|
31
33
|
reduceIdents: false,
|
|
32
34
|
// Font families live in custom properties discardUnused cannot see.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allons-y/course-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.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)",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"test": "node --test",
|
|
38
38
|
"schema": "node scripts/theme-schema.js && node scripts/theme-docs.js",
|
|
39
39
|
"docs": "node scripts/component-docs.js && node scripts/copy-docs.js",
|
|
40
|
+
"check:pdf": "node scripts/check-pdf.js",
|
|
40
41
|
"preview": "node scripts/site.js start",
|
|
41
42
|
"preview:build": "node scripts/site.js build",
|
|
42
43
|
"docs:build": "node scripts/site.js build",
|
|
@@ -115,6 +116,7 @@
|
|
|
115
116
|
"flavor": "landing"
|
|
116
117
|
},
|
|
117
118
|
"publishConfig": {
|
|
118
|
-
"access": "public"
|
|
119
|
+
"access": "public",
|
|
120
|
+
"provenance": true
|
|
119
121
|
}
|
|
120
122
|
}
|
|
@@ -84,6 +84,16 @@
|
|
|
84
84
|
},
|
|
85
85
|
"description": "Section-specific outcomes layered on top of the committed catalog set."
|
|
86
86
|
},
|
|
87
|
+
"syllabusContents": {
|
|
88
|
+
"type": "boolean",
|
|
89
|
+
"default": true,
|
|
90
|
+
"description": "Whether the `<syllabus>` shows its contents list (a row of links above the syllabus, and from 1100px a sticky column beside it). `false` leaves it out. The tag's `contents=\"false\"` attribute does the same for one place and wins over this."
|
|
91
|
+
},
|
|
92
|
+
"navColumns": {
|
|
93
|
+
"enum": ["auto", 1, 2],
|
|
94
|
+
"default": "auto",
|
|
95
|
+
"description": "How many columns the menu in the page header is set in. `auto` (the default) uses two columns when the menu has more than 3 links, which keeps the header short, and one stack otherwise; `1` and `2` fix it either way. The `<masthead>` tag's `nav-columns` attribute does the same for one place and wins over this."
|
|
96
|
+
},
|
|
87
97
|
"textbook": {
|
|
88
98
|
"type": "object",
|
|
89
99
|
"description": "Required text and how to get it — the textbook/materials element Meredith requires. Omit the whole key ONLY when the course has no text: the `<syllabus>` component then renders \"No text is required.\", which is still an explicit materials statement. Never leave the key present but empty.",
|
|
@@ -43,6 +43,14 @@
|
|
|
43
43
|
"format": "uri",
|
|
44
44
|
"description": "Optional personal site or blog, shown as its own row in the instructor panel."
|
|
45
45
|
},
|
|
46
|
+
"contactLinks": {
|
|
47
|
+
"enum": [
|
|
48
|
+
"rows",
|
|
49
|
+
"icons"
|
|
50
|
+
],
|
|
51
|
+
"default": "rows",
|
|
52
|
+
"description": "How the email, the message link and the blog are shown in the instructor panel: `rows` (the default) lists them in the fact list; `icons` shows each as an icon link in the top right of the panel, with the address or host printed in its place. The `<instructor>` tag's `contact-links` attribute overrides it."
|
|
53
|
+
},
|
|
46
54
|
"photo": {
|
|
47
55
|
"type": "string",
|
|
48
56
|
"pattern": "^/images/",
|
|
@@ -26,9 +26,14 @@
|
|
|
26
26
|
"default": true,
|
|
27
27
|
"description": "Set false to keep the page out of the sitemap and search results. Does NOT gate publishing — the page is still served to anyone with the URL."
|
|
28
28
|
},
|
|
29
|
+
"order": {
|
|
30
|
+
"type": "integer",
|
|
31
|
+
"minimum": 0,
|
|
32
|
+
"description": "Where the worksheet sits in the Practice page's list (`<practice-index>`): lower numbers first, then by address. A worksheet with no order comes after those that have one."
|
|
33
|
+
},
|
|
29
34
|
"eyebrow": {
|
|
30
35
|
"type": "string",
|
|
31
|
-
"description": "Small-caps label above the heading,
|
|
36
|
+
"description": "Small-caps label above the heading, such as the kind of page (\"Practice\"). The masthead already gives the term and course code, so the page does not repeat them."
|
|
32
37
|
},
|
|
33
38
|
"heading": {
|
|
34
39
|
"type": "string",
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The deck's saved light/dark choice, applied before first paint so a deck
|
|
3
|
-
* never flashes the wrong scheme. Only the deck layout inlines this, through
|
|
4
|
-
* the `head` bundle bucket; the site and worksheets follow the system.
|
|
5
|
-
*/
|
|
6
|
-
try {
|
|
7
|
-
const theme = localStorage.getItem("theme");
|
|
8
|
-
if (theme === "light" || theme === "dark") {
|
|
9
|
-
document.documentElement.style.colorScheme = theme;
|
|
10
|
-
document.documentElement.dataset.theme = theme;
|
|
11
|
-
for (const link of document.querySelectorAll("link[data-prism-theme]")) {
|
|
12
|
-
link.media = link.dataset.prismTheme === theme ? "all" : "not all";
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
} catch {
|
|
16
|
-
// Storage can be unavailable (private mode, blocked cookies); follow system.
|
|
17
|
-
}
|