@allons-y/course-kit 0.4.1 → 0.4.3

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.
@@ -1625,6 +1625,7 @@ blockquote {
1625
1625
  selecting or copying never takes them. */
1626
1626
  .code-block {
1627
1627
  --code-edge: var(--color-code-edge-neutral);
1628
+ --code-line-height: 1;
1628
1629
 
1629
1630
  position: relative;
1630
1631
  margin-block: 0 1rem;
@@ -1693,6 +1694,11 @@ blockquote {
1693
1694
  @media print { display: none; }
1694
1695
  }
1695
1696
 
1697
+ pre,
1698
+ code {
1699
+ line-height: var(--code-line-height);
1700
+ }
1701
+
1696
1702
  pre {
1697
1703
  margin: 0;
1698
1704
  border: 0;
@@ -2209,6 +2215,7 @@ legend.switch-label {
2209
2215
  pre[class*="language-"],
2210
2216
  code[class*="language-"] {
2211
2217
  color: var(--color-code-text);
2218
+ line-height: var(--code-line-height, 1);
2212
2219
  text-shadow: none;
2213
2220
  }
2214
2221
 
@@ -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 that crosses a line just below the
288
- * row (or, in the gap between two weeks, the next one); before the first week reaches it the first month, after the last week the last month. Sets `--schedule-bar-height`
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
- // The first week that is not wholly above the line: the one crossing it, or the next one when the line is in the gap between two,
305
- // and the first week while the header is still on screen. After the last week, the last month.
306
- const week = shown.find((candidate) => candidate.getBoundingClientRect().bottom > line);
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allons-y/course-kit",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
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)",