@allons-y/course-kit 0.4.0 → 0.4.2
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.
|
@@ -284,8 +284,8 @@
|
|
|
284
284
|
|
|
285
285
|
<script>
|
|
286
286
|
/**
|
|
287
|
-
* Marks the month on screen in the row with `aria-current="location"`: the month of the week block
|
|
288
|
-
*
|
|
287
|
+
* Marks the month on screen in the row with `aria-current="location"`: the month of the last week block whose top has reached the line where an
|
|
288
|
+
* anchor lands it, below the row; before the first week reaches it the first month, at the foot of the page the last month. Sets `--schedule-bar-height`
|
|
289
289
|
* for the page's scroll-padding while the row is sticky. It changes no size and runs no animation.
|
|
290
290
|
*/
|
|
291
291
|
(() => {
|
|
@@ -298,12 +298,12 @@
|
|
|
298
298
|
/** The month of a week: the latest month whose range holds it, so a week spanning two months reads as the second, where its link points. */
|
|
299
299
|
const monthOf = (number) => range.findLast(({ first, last }) => number >= first && number <= last) ?? range.at(-1);
|
|
300
300
|
const mark = () => {
|
|
301
|
-
const line = Math.max(0, bar.getBoundingClientRect().bottom) + 8;
|
|
302
301
|
const shown = weeks.filter((week) => !week.hidden);
|
|
303
302
|
if (!shown.length) return;
|
|
304
|
-
//
|
|
305
|
-
|
|
306
|
-
|
|
303
|
+
// Where an anchor lands a week's top: below the row, by the page's scroll-padding and the week's scroll-margin. The week is on screen once its top is at or above that line.
|
|
304
|
+
const line = (Number.parseFloat(getComputedStyle(document.documentElement).scrollPaddingTop) || 0) + (Number.parseFloat(getComputedStyle(shown[0]).scrollMarginTop) || 0) + 1;
|
|
305
|
+
// The last week whose top has reached the line, or the first week before any has.
|
|
306
|
+
const week = shown.findLast((candidate) => candidate.getBoundingClientRect().top <= line) ?? shown[0];
|
|
307
307
|
// A page scrolled to its foot can leave the last week below the line: then the last month is the one on screen.
|
|
308
308
|
const bottomed = window.scrollY > 0 && window.scrollY + window.innerHeight >= document.documentElement.scrollHeight - 2;
|
|
309
309
|
const current = week && !bottomed ? monthOf(Number(week.id.slice(5))) : range.at(-1);
|
|
@@ -112,6 +112,15 @@
|
|
|
112
112
|
margin-block-start: 0.25em;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
/* Each link is a 44px target (WCAG 2.5.5); it sits in a paragraph, so the
|
|
116
|
+
table-wide cell-link rule does not reach it. */
|
|
117
|
+
:host :is(.deck-title, .notes) a {
|
|
118
|
+
display: inline-flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
gap: 0.25em;
|
|
121
|
+
min-block-size: var(--target-min);
|
|
122
|
+
}
|
|
123
|
+
|
|
115
124
|
@media screen and (width <= 640px) {
|
|
116
125
|
:host,
|
|
117
126
|
:host tbody,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allons-y/course-kit",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
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)",
|