astro-better-release-notes 0.2.2 → 0.2.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.
- package/README.md +14 -5
- package/ReleaseNotesSelector.astro +19 -7
- package/package.json +1 -1
- package/style.css +17 -2
package/README.md
CHANGED
|
@@ -115,14 +115,17 @@ Set both variables on `html` or any ancestor of `.release-container`.
|
|
|
115
115
|
|
|
116
116
|
### Link colors
|
|
117
117
|
|
|
118
|
-
The
|
|
118
|
+
The issue links, version permalinks (`#`), and category badge hover colors are configurable:
|
|
119
119
|
|
|
120
120
|
| Variable | Default | Description |
|
|
121
121
|
|----------|---------|-------------|
|
|
122
|
-
| `--release-notes-link-color` | `#4338ca` (indigo-700) | Issue link color |
|
|
123
|
-
| `--release-notes-link-hover-color` | `#9a3412` (orange-800) | Hover color for links and
|
|
124
|
-
| `--release-notes-link-color-dark` | `#818cf8` (indigo-400) | Dark mode link color |
|
|
122
|
+
| `--release-notes-link-color` | `#4338ca` (indigo-700) | Issue link and permalink color |
|
|
123
|
+
| `--release-notes-link-hover-color` | `#9a3412` (orange-800) | Hover color for links, permalinks, and badges |
|
|
124
|
+
| `--release-notes-link-color-dark` | `#818cf8` (indigo-400) | Dark mode link and permalink color |
|
|
125
125
|
| `--release-notes-link-hover-color-dark` | `#fed7aa` (orange-200) | Dark mode hover color |
|
|
126
|
+
| `--release-notes-anchor-size` | `1.5em` | Font size of the version permalink; match it to your `h2` size |
|
|
127
|
+
|
|
128
|
+
The permalink sits beside the version heading rather than inside it, so it doesn't inherit the heading's size. Set `--release-notes-anchor-size` if your `h2` isn't `1.5em`.
|
|
126
129
|
|
|
127
130
|
### Theme variables
|
|
128
131
|
|
|
@@ -235,10 +238,16 @@ import { ReleaseNotesSelector } from 'astro-better-release-notes';
|
|
|
235
238
|
- Each version is an `<article>` labelled by its `<h2>`. The `<h2>` carries the anchor id (`version-1-2-3`), so fragment links, search crawlers, and TOC tools all resolve to the heading. The `#` permalink sits next to the heading rather than inside it, so the heading's accessible name is only the version.
|
|
236
239
|
- Category filters are native checkboxes inside a `<fieldset>` with a visually hidden `<legend>`. They work with Tab and Space, show a focus ring on the chip, and announce their checked state. Selected chips show a check mark as well as color.
|
|
237
240
|
- Badge and selected-chip text colors are mixed from the category color (darker in light mode, lighter in dark mode), so they stay at or above 4.5:1 for the default categories and for most custom mid-tone colors.
|
|
238
|
-
- The version selector has a label and
|
|
241
|
+
- The version selector has a label, and its options are bare version numbers, so typing `1.56` jumps to 1.56.0. Each jump is announced through a polite live region. Focus stays on the selector so type-ahead and arrow keys keep working: the selector scrolls with `scrollIntoView` and updates the URL with `history.replaceState`, because assigning `location.hash` would blur it. Jumps don't add browser history entries.
|
|
239
242
|
- Transitions and the badge hover scale are disabled under `prefers-reduced-motion: reduce`.
|
|
240
243
|
- The package ships its own `.rn-sr-only` class, so it doesn't depend on a host `sr-only` utility.
|
|
241
244
|
|
|
245
|
+
## Upgrading to 0.2.3
|
|
246
|
+
|
|
247
|
+
- Version selector options no longer start with "Version" (`1.56.0 (SSO Snake)` instead of `Version 1.56.0 (SSO Snake)`).
|
|
248
|
+
- Choosing a version updates the URL with `history.replaceState` instead of a new history entry, so the Back button leaves the page rather than stepping back through jumps.
|
|
249
|
+
- The version permalink now uses the link color variables and `--release-notes-anchor-size` instead of inheriting the surrounding text color and size.
|
|
250
|
+
|
|
242
251
|
## Upgrading to 0.2.2
|
|
243
252
|
|
|
244
253
|
Anchor URLs are unchanged, but the markup moved:
|
|
@@ -23,7 +23,8 @@ const { updates } = Astro.props as Props;
|
|
|
23
23
|
<option value="">Jump to a version...</option>
|
|
24
24
|
{updates.map((item) => {
|
|
25
25
|
const versionId = `version-${item.data.version.replaceAll('.', '-')}`;
|
|
26
|
-
|
|
26
|
+
// bare version so typing in the select jumps straight to it; the label supplies the context
|
|
27
|
+
const label = `${item.data.version}${item.data.name ? ` (${item.data.name})` : ''}`;
|
|
27
28
|
return <option value={versionId}>{label}</option>;
|
|
28
29
|
})}
|
|
29
30
|
</select>
|
|
@@ -65,8 +66,13 @@ const { updates } = Astro.props as Props;
|
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
if (activeArticle
|
|
69
|
-
|
|
69
|
+
if (activeArticle) currentActiveId = headingId(activeArticle);
|
|
70
|
+
// writing value mid-interaction resets native type-ahead, so wait for blur
|
|
71
|
+
if (document.activeElement !== selectEl) syncSelect();
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const syncSelect = () => {
|
|
75
|
+
if (currentActiveId && selectEl.value !== currentActiveId) {
|
|
70
76
|
selectEl.value = currentActiveId;
|
|
71
77
|
disablePlaceholder();
|
|
72
78
|
}
|
|
@@ -83,13 +89,19 @@ const { updates } = Astro.props as Props;
|
|
|
83
89
|
}
|
|
84
90
|
};
|
|
85
91
|
|
|
86
|
-
//
|
|
92
|
+
// hide the placeholder before typing starts; changing options mid-type-ahead resets it
|
|
93
|
+
selectEl.addEventListener('focus', disablePlaceholder, { once: true });
|
|
94
|
+
selectEl.addEventListener('blur', syncSelect);
|
|
95
|
+
|
|
96
|
+
// location.hash blurs the select (breaks type-ahead/arrows); replaceState also skips per-key history entries
|
|
87
97
|
selectEl.addEventListener('change', () => {
|
|
88
98
|
hasUserInteracted = true;
|
|
89
99
|
disablePlaceholder();
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
100
|
+
const target = selectEl.value && document.getElementById(selectEl.value);
|
|
101
|
+
if (!target) return;
|
|
102
|
+
history.replaceState(history.state, '', `#${selectEl.value}`);
|
|
103
|
+
target.scrollIntoView({ block: 'start' });
|
|
104
|
+
if (statusEl) statusEl.textContent = `Jumped to version ${selectEl.selectedOptions[0]?.textContent ?? selectEl.value}`;
|
|
93
105
|
});
|
|
94
106
|
|
|
95
107
|
const filterControls = document.querySelector('.filter-controls');
|
package/package.json
CHANGED
package/style.css
CHANGED
|
@@ -387,13 +387,16 @@
|
|
|
387
387
|
Version anchor links (# permalink)
|
|
388
388
|
--------------------------------------------------------------- */
|
|
389
389
|
|
|
390
|
+
/* sits beside the h2, not inside it, so size it to match the heading */
|
|
390
391
|
.version-title .anchor-link {
|
|
391
392
|
opacity: 0;
|
|
393
|
+
font-size: var(--release-notes-anchor-size, 1.5em);
|
|
394
|
+
font-weight: 500;
|
|
392
395
|
text-decoration: none;
|
|
393
396
|
border: none;
|
|
394
397
|
margin-left: 0.5rem;
|
|
395
|
-
color:
|
|
396
|
-
transition: opacity 0.15s ease;
|
|
398
|
+
color: var(--release-notes-link-color, #4338ca);
|
|
399
|
+
transition: opacity 0.15s ease, color 0.15s ease;
|
|
397
400
|
}
|
|
398
401
|
|
|
399
402
|
.version-title:hover .anchor-link,
|
|
@@ -401,6 +404,18 @@
|
|
|
401
404
|
opacity: 1;
|
|
402
405
|
}
|
|
403
406
|
|
|
407
|
+
.version-title .anchor-link:hover {
|
|
408
|
+
color: var(--release-notes-link-hover-color, #9a3412);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.dark .version-title .anchor-link {
|
|
412
|
+
color: var(--release-notes-link-color-dark, #818cf8);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.dark .version-title .anchor-link:hover {
|
|
416
|
+
color: var(--release-notes-link-hover-color-dark, #fed7aa);
|
|
417
|
+
}
|
|
418
|
+
|
|
404
419
|
/* ---------------------------------------------------------------
|
|
405
420
|
Utilities and motion
|
|
406
421
|
--------------------------------------------------------------- */
|