starlight-heading-badges 0.2.0 → 0.4.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/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # starlight-heading-badges
2
+
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#8](https://github.com/HiDeoo/starlight-heading-badges/pull/8) [`51c2bca`](https://github.com/HiDeoo/starlight-heading-badges/commit/51c2bcad815af8be5d2d93fba8221eba182cd72d) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Adds support for Astro v5, drops support for Astro v4.
8
+
9
+ ⚠️ **BREAKING CHANGE:** The minimum supported version of Starlight is now `0.30.0`.
10
+
11
+ Please follow the [upgrade guide](https://github.com/withastro/starlight/releases/tag/%40astrojs/starlight%400.30.0) to update your project.
@@ -9,7 +9,7 @@ import type { Props } from '@astrojs/starlight/props'
9
9
 
10
10
  import TableOfContentsList from './TableOfContentsList.astro'
11
11
 
12
- const { labels, toc } = Astro.props
12
+ const { toc } = Astro.props
13
13
  ---
14
14
 
15
15
  {
@@ -19,7 +19,7 @@ const { labels, toc } = Astro.props
19
19
  <details id="starlight__mobile-toc">
20
20
  <summary id="starlight__on-this-page--mobile" class="sl-flex">
21
21
  <div class="toggle sl-flex">
22
- {labels['tableOfContents.onThisPage']}
22
+ {Astro.locals.t('tableOfContents.onThisPage')}
23
23
  <Icon name={'right-caret'} class="caret" size="1rem" />
24
24
  </div>
25
25
  <span class="display-current" />
@@ -157,11 +157,11 @@ const { labels, toc } = Astro.props
157
157
  link.addEventListener('click', closeToC)
158
158
  }
159
159
  // Close the table of contents when a user clicks outside of it.
160
- window.addEventListener('click', (e) => {
160
+ globalThis.addEventListener('click', (e) => {
161
161
  if (!details.contains(e.target as Node)) closeToC()
162
162
  })
163
163
  // Or when they press the escape key.
164
- window.addEventListener('keydown', (e) => {
164
+ globalThis.addEventListener('keydown', (e) => {
165
165
  if (e.key === 'Escape' && details.open) {
166
166
  const hasFocus = details.contains(document.activeElement)
167
167
  closeToC()
@@ -8,14 +8,14 @@ import type { Props } from '@astrojs/starlight/props'
8
8
 
9
9
  import TableOfContentsList from './TableOfContentsList.astro'
10
10
 
11
- const { labels, toc } = Astro.props
11
+ const { toc } = Astro.props
12
12
  ---
13
13
 
14
14
  {
15
15
  toc && (
16
16
  <starlight-toc data-min-h={toc.minHeadingLevel} data-max-h={toc.maxHeadingLevel}>
17
17
  <nav aria-labelledby="starlight__on-this-page">
18
- <h2 id="starlight__on-this-page">{labels['tableOfContents.onThisPage']}</h2>
18
+ <h2 id="starlight__on-this-page">{Astro.locals.t('tableOfContents.onThisPage')}</h2>
19
19
  <TableOfContentsList toc={toc.items} />
20
20
  </nav>
21
21
  </starlight-toc>
@@ -74,8 +74,7 @@ export class StarlightTOC extends HTMLElement {
74
74
  observe()
75
75
 
76
76
  // `requestIdleCallback` is not available in Safari.
77
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
78
- const onIdle = window.requestIdleCallback || ((cb) => setTimeout(cb, 1))
77
+ const onIdle = globalThis.requestIdleCallback || ((cb) => setTimeout(cb, 1))
79
78
  let timeout: NodeJS.Timeout
80
79
  window.addEventListener('resize', () => {
81
80
  // Disable intersection observer while window is resizing.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starlight-heading-badges",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "license": "MIT",
5
5
  "description": "Starlight plugin to add badges to your Markdown and MDX headings.",
6
6
  "author": "HiDeoo <github@hideoo.dev> (https://hideoo.dev)",
@@ -15,24 +15,25 @@
15
15
  "./package.json": "./package.json"
16
16
  },
17
17
  "dependencies": {
18
- "@astrojs/markdown-remark": "^5.1.1",
18
+ "@astrojs/markdown-remark": "^6.0.1",
19
19
  "github-slugger": "^2.0.0",
20
20
  "unist-util-visit": "^5.0.0"
21
21
  },
22
22
  "devDependencies": {
23
- "@playwright/test": "^1.45.0",
23
+ "@playwright/test": "^1.49.1",
24
24
  "@types/hast": "^3.0.4",
25
25
  "@types/mdast": "^4.0.4",
26
26
  "mdast-util-directive": "^3.0.0"
27
27
  },
28
28
  "peerDependencies": {
29
- "@astrojs/starlight": ">=0.24.5"
29
+ "@astrojs/starlight": ">=0.30.0"
30
30
  },
31
31
  "engines": {
32
32
  "node": ">=18"
33
33
  },
34
34
  "publishConfig": {
35
- "access": "public"
35
+ "access": "public",
36
+ "provenance": true
36
37
  },
37
38
  "sideEffects": false,
38
39
  "keywords": [
@@ -52,6 +53,6 @@
52
53
  "bugs": "https://github.com/HiDeoo/starlight-heading-badges/issues",
53
54
  "scripts": {
54
55
  "test": "playwright install --with-deps chromium && playwright test",
55
- "lint": "prettier -c --cache . && eslint . --cache --max-warnings=0"
56
+ "lint": "eslint . --cache --max-warnings=0"
56
57
  }
57
58
  }