@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.
- package/LICENSE +373 -0
- package/README.md +90 -2
- package/assets/fonts/instrument-sans-italic-var.woff2 +0 -0
- package/assets/fonts/instrument-sans-var.woff2 +0 -0
- package/assets/fonts/pt-mono.woff2 +0 -0
- package/assets/scripts/copy.js +99 -0
- package/assets/scripts/deck.js +161 -0
- package/assets/scripts/email.js +19 -0
- package/assets/scripts/practice.js +545 -0
- package/assets/scripts/theme-panel.js +647 -0
- package/assets/scripts/theme-restore.js +17 -0
- package/assets/styles/base.css +2091 -0
- package/assets/styles/deck.css +968 -0
- package/assets/styles/font.css +36 -0
- package/assets/styles/notes.css +137 -0
- package/assets/styles/print.css +428 -0
- package/assets/styles/semantics.css +101 -0
- package/components/practice/check-controls.webc +50 -0
- package/components/practice/choice-list.webc +86 -0
- package/components/practice/cite-panel.webc +108 -0
- package/components/practice/practice-figure.webc +47 -0
- package/components/practice/practice-fill.webc +154 -0
- package/components/practice/practice-grid.webc +82 -0
- package/components/practice/practice-judge.webc +165 -0
- package/components/practice/practice-match.webc +178 -0
- package/components/practice/practice-question.webc +141 -0
- package/components/practice/practice-selfcheck.webc +40 -0
- package/components/practice/practice-terms.webc +95 -0
- package/components/practice/practice-tree.webc +91 -0
- package/components/practice/practice-worksheet.webc +369 -0
- package/components/site/copyright.webc +13 -0
- package/components/site/course-documents.webc +27 -0
- package/components/site/course-now.webc +393 -0
- package/components/site/course-summary.webc +136 -0
- package/components/site/demo-weeks.webc +91 -0
- package/components/site/glossary-entry.webc +31 -0
- package/components/site/glossary-panel.webc +1482 -0
- package/components/site/glossary.webc +45 -0
- package/components/site/grading.webc +50 -0
- package/components/site/instructor.webc +432 -0
- package/components/site/masthead.webc +147 -0
- package/components/site/nav-links.webc +174 -0
- package/components/site/policies.webc +17 -0
- package/components/site/practice-index.webc +31 -0
- package/components/site/schedule-overview.webc +145 -0
- package/components/site/schedule-weeks.webc +589 -0
- package/components/site/site-footer.webc +119 -0
- package/components/site/slide-timetable.webc +152 -0
- package/components/site/syllabus.webc +370 -0
- package/components/ui/arrow-link.webc +19 -0
- package/components/ui/assigned-list.webc +101 -0
- package/components/ui/callout.webc +11 -0
- package/components/ui/card-list.webc +124 -0
- package/components/ui/codepen-embed.webc +123 -0
- package/components/ui/download-button.webc +49 -0
- package/components/ui/eyebrow.webc +18 -0
- package/components/ui/icons/github.webc +6 -0
- package/components/ui/icons/google.webc +9 -0
- package/components/ui/link-list.webc +130 -0
- package/components/ui/link-section.webc +40 -0
- package/components/ui/meeting-card.webc +73 -0
- package/components/ui/meeting-decks.webc +38 -0
- package/components/ui/table-rubric.webc +251 -0
- package/components/ui/today-link.webc +43 -0
- package/components/ui/today-marker.webc +149 -0
- package/components/ui/week-block.webc +53 -0
- package/examples/starter/_data/course.json +20 -0
- package/examples/starter/_data/dates.json +16 -0
- package/examples/starter/_data/grading.json +6 -0
- package/examples/starter/_data/instructor.json +7 -0
- package/examples/starter/_data/policies.json +9 -0
- package/examples/starter/_data/scale.json +8 -0
- package/examples/starter/_data/schedule.json +22 -0
- package/examples/starter/_data/theme.json +17 -0
- package/examples/starter/content/index.webc +12 -0
- package/examples/starter/content/schedule.webc +12 -0
- package/examples/starter/content/slides/index.11tydata.js +5 -0
- package/examples/starter/content/slides/index.webc +12 -0
- package/examples/starter/content/slides/week-1-day-1.md +40 -0
- package/examples/starter/eleventy.config.js +8 -0
- package/glue/deck-notes.data.js +41 -0
- package/glue/deck-notes.webc +32 -0
- package/glue/lesson-day.data.js +17 -0
- package/glue/lesson-day.webc +0 -0
- package/glue/lesson-plans.data.js +13 -0
- package/glue/lesson-plans.webc +2 -0
- package/index.js +6 -0
- package/layouts/base.webc +79 -0
- package/layouts/deck.webc +46 -0
- package/layouts/demo.webc +16 -0
- package/layouts/document.webc +10 -0
- package/layouts/lesson-detail.webc +109 -0
- package/layouts/lesson.webc +71 -0
- package/layouts/notes.webc +23 -0
- package/layouts/worksheet.webc +52 -0
- package/lib/assets.js +42 -0
- package/lib/bundles.js +79 -0
- package/lib/check.js +110 -0
- package/lib/components.js +19 -0
- package/lib/copy.js +656 -0
- package/lib/data/build.js +22 -0
- package/lib/data/fonts.js +16 -0
- package/lib/data/glossary.js +304 -0
- package/lib/data/index.js +8 -0
- package/lib/data/lessons.js +173 -0
- package/lib/data/project.js +22 -0
- package/lib/data/read.js +61 -0
- package/lib/data/site.js +70 -0
- package/lib/data/term.js +80 -0
- package/lib/extensions.js +70 -0
- package/lib/files.js +14 -0
- package/lib/filters.js +584 -0
- package/lib/fit.js +106 -0
- package/lib/glue.js +26 -0
- package/lib/lesson-materials.js +66 -0
- package/lib/markdown.js +568 -0
- package/lib/minify.js +53 -0
- package/lib/paths.js +5 -0
- package/lib/pdf.js +134 -0
- package/lib/plugin.js +231 -0
- package/lib/plugins.js +34 -0
- package/lib/postcss.js +93 -0
- package/lib/theme-server.js +88 -0
- package/lib/theme.js +185 -0
- package/lib/worksheet-dialect.js +415 -0
- package/lib/worksheets.js +276 -0
- package/package.json +119 -4
- package/schemas/course.schema.json +161 -0
- package/schemas/dates.schema.json +165 -0
- package/schemas/grading.schema.json +59 -0
- package/schemas/instructor.schema.json +76 -0
- package/schemas/policies.schema.json +90 -0
- package/schemas/project.schema.json +209 -0
- package/schemas/scale.schema.json +68 -0
- package/schemas/schedule.schema.json +260 -0
- package/schemas/theme.schema.json +704 -0
- package/schemas/worksheet.schema.json +449 -0
package/lib/data/term.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { resolveCopy } from "../copy.js";
|
|
2
|
+
import { dateRange, fullDate } from "../filters.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The current academic term. Which term is data: `term` in course.json names a
|
|
6
|
+
* year and season in dates.json.
|
|
7
|
+
* @param {{ course: object, dates: object }} data
|
|
8
|
+
* @returns {object} year, season, label, calendar, finalExamsDisplay, keyDates, instructorDates
|
|
9
|
+
*/
|
|
10
|
+
export function resolveTerm({ course, dates }) {
|
|
11
|
+
if (!course || Object.keys(course).length === 0) {
|
|
12
|
+
throw new Error("There is no course.json, or it is empty. Every course needs one in its data folder (_data): copy examples/starter/_data/course.json and edit it.");
|
|
13
|
+
}
|
|
14
|
+
if (!course.term?.year || !course.term?.season) {
|
|
15
|
+
throw new Error('course.json needs a `term`, for example { "year": 2026, "season": "fall" }.');
|
|
16
|
+
}
|
|
17
|
+
const { year, season } = course.term;
|
|
18
|
+
const copy = resolveCopy().term;
|
|
19
|
+
const calendar = dates[year]?.[season];
|
|
20
|
+
if (!calendar) {
|
|
21
|
+
const carried = Object.entries(dates)
|
|
22
|
+
.filter(([key]) => /^\d{4}$/.test(key))
|
|
23
|
+
.flatMap(([key, terms]) => Object.keys(terms).map((name) => `${key} ${name}`));
|
|
24
|
+
throw new Error(
|
|
25
|
+
`course.json says the term is ${year} ${season}, but dates.json has ${carried.length ? carried.join(", ") : "no terms"}. ` +
|
|
26
|
+
"Match the year and season exactly; the season is lowercase (spring, summer or fall).",
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// "students" deadlines feed the syllabus, "faculty" ones the lesson pages.
|
|
31
|
+
const deadlinesFor = (audience) =>
|
|
32
|
+
Object.values(calendar.deadlines)
|
|
33
|
+
.filter((deadline) => deadline.audience === audience)
|
|
34
|
+
.map(({ date, label }) => ({ date, label, display: fullDate(date) }));
|
|
35
|
+
|
|
36
|
+
const exams = calendar.finalExams;
|
|
37
|
+
const finalExamsDisplay = dateRange(exams.start, exams.end);
|
|
38
|
+
|
|
39
|
+
const holidayStart = (holiday) => (typeof holiday === "string" ? holiday : holiday.start);
|
|
40
|
+
const readingDays = calendar.readingDays ?? (calendar.readingDay ? [calendar.readingDay] : []);
|
|
41
|
+
const keyDates = [
|
|
42
|
+
{ date: calendar.start, label: copy.classesBegin, display: fullDate(calendar.start) },
|
|
43
|
+
...deadlinesFor("students"),
|
|
44
|
+
...calendar.holidays.map((holiday) => ({
|
|
45
|
+
date: holidayStart(holiday),
|
|
46
|
+
label: dates.LABELS?.[holidayStart(holiday)] ?? copy.collegeHoliday,
|
|
47
|
+
display: typeof holiday === "string" ? fullDate(holiday) : dateRange(holiday.start, holiday.end),
|
|
48
|
+
})),
|
|
49
|
+
{ date: calendar.end, label: copy.lastDayOfClasses, display: fullDate(calendar.end) },
|
|
50
|
+
...(readingDays.length
|
|
51
|
+
? [{
|
|
52
|
+
date: readingDays[0],
|
|
53
|
+
label: copy.readingDaysNoClasses,
|
|
54
|
+
display: readingDays.length > 1 ? dateRange(readingDays[0], readingDays[readingDays.length - 1]) : fullDate(readingDays[0]),
|
|
55
|
+
}]
|
|
56
|
+
: []),
|
|
57
|
+
{ date: exams.start, label: copy.finalExaminationPeriod, display: finalExamsDisplay },
|
|
58
|
+
].sort((a, b) => a.date.localeCompare(b.date));
|
|
59
|
+
|
|
60
|
+
const instructorDates = [
|
|
61
|
+
...deadlinesFor("faculty"),
|
|
62
|
+
...(calendar.preRegistration
|
|
63
|
+
? [{
|
|
64
|
+
date: calendar.preRegistration,
|
|
65
|
+
label: copy.preregistrationForTheNext,
|
|
66
|
+
display: fullDate(calendar.preRegistration),
|
|
67
|
+
}]
|
|
68
|
+
: []),
|
|
69
|
+
].sort((a, b) => a.date.localeCompare(b.date));
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
year,
|
|
73
|
+
season,
|
|
74
|
+
label: `${season[0].toUpperCase()}${season.slice(1)} ${year}`,
|
|
75
|
+
calendar,
|
|
76
|
+
finalExamsDisplay,
|
|
77
|
+
keyDates,
|
|
78
|
+
instructorDates,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
import esbuild from "esbuild";
|
|
5
|
+
|
|
6
|
+
import { assetPath } from "./assets.js";
|
|
7
|
+
import { processCSS } from "./postcss.js";
|
|
8
|
+
import { applyTokens, resolveTheme } from "./theme.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Build `.js` under a `scripts` directory with esbuild and `.css` with PostCSS, each written flat to `/js` and `/styles`. See docs/internals.md.
|
|
12
|
+
* @param {import('@11ty/eleventy').UserConfig} config
|
|
13
|
+
* @param {{ isProduction: boolean, inputDir?: string, theme?: () => ReturnType<typeof resolveTheme> }} options `theme` is read per compile, so a saved theme.json shows under --watch
|
|
14
|
+
*/
|
|
15
|
+
export default function registerExtensions(config, { isProduction, inputDir = "content", theme = () => resolveTheme() }) {
|
|
16
|
+
config.addTemplateFormats("js");
|
|
17
|
+
config.addExtension("js", {
|
|
18
|
+
outputFileExtension: "js",
|
|
19
|
+
useLayouts: false,
|
|
20
|
+
async compile(content, inputPath) {
|
|
21
|
+
const parsed = path.parse(inputPath);
|
|
22
|
+
if (!parsed.dir.endsWith("scripts")) return;
|
|
23
|
+
|
|
24
|
+
return async () => {
|
|
25
|
+
const packaged = assetPath(`scripts/${parsed.base}`, inputDir);
|
|
26
|
+
const result = await esbuild.build({
|
|
27
|
+
...(existsSync(inputPath)
|
|
28
|
+
? { entryPoints: [inputPath] }
|
|
29
|
+
: { stdin: { contents: content, resolveDir: path.dirname(packaged ?? "."), sourcefile: packaged ?? inputPath } }),
|
|
30
|
+
bundle: true,
|
|
31
|
+
format: "esm",
|
|
32
|
+
platform: "browser",
|
|
33
|
+
minify: isProduction,
|
|
34
|
+
sourcemap: isProduction ? false : "inline",
|
|
35
|
+
write: false,
|
|
36
|
+
});
|
|
37
|
+
return result.outputFiles[0].text;
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
compileOptions: {
|
|
41
|
+
permalink(_, inputPath) {
|
|
42
|
+
// Same guard as compile, or every .js file collides on its permalink.
|
|
43
|
+
if (!path.parse(inputPath).dir.endsWith("scripts")) return false;
|
|
44
|
+
return () => path.join(config.directoryAssignments.js, path.basename(inputPath));
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
config.addTemplateFormats("css");
|
|
50
|
+
config.addExtension("css", {
|
|
51
|
+
outputFileExtension: "css",
|
|
52
|
+
useLayouts: false,
|
|
53
|
+
async compile(content, inputPath) {
|
|
54
|
+
const parsed = path.parse(inputPath);
|
|
55
|
+
if (parsed.base.startsWith("_")) return;
|
|
56
|
+
|
|
57
|
+
return async () => {
|
|
58
|
+
if (!content || !content.trim()) return content;
|
|
59
|
+
return processCSS(applyTokens(content, theme()), this, { inputDir });
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
compileOptions: {
|
|
63
|
+
permalink(_, inputPath) {
|
|
64
|
+
// Same guard as compile.
|
|
65
|
+
if (path.parse(inputPath).base.startsWith("_")) return false;
|
|
66
|
+
return () => path.join(config.directoryAssignments.css, path.basename(inputPath));
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
}
|
package/lib/files.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {string} dir
|
|
6
|
+
* @param {(name: string) => boolean} [match] which file names to keep
|
|
7
|
+
* @returns {string[]} files under dir, recursively; [] when dir is missing
|
|
8
|
+
*/
|
|
9
|
+
export const walk = (dir, match = () => true) =>
|
|
10
|
+
fs.existsSync(dir)
|
|
11
|
+
? fs.readdirSync(dir, { withFileTypes: true }).flatMap((entry) =>
|
|
12
|
+
entry.isDirectory() ? walk(path.join(dir, entry.name), match) : match(entry.name) ? [path.join(dir, entry.name)] : [],
|
|
13
|
+
)
|
|
14
|
+
: [];
|