|
1 | 1 | # @astrojs/starlight
|
2 | 2 |
|
| 3 | +## 0.32.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- [#2390](https://github.com/withastro/starlight/pull/2390) [`f493361`](https://github.com/withastro/starlight/commit/f493361d7b64a3279980e0f046c3a52196ab94e0) Thanks [@delucis](https://github.com/delucis)! - Moves route data to `Astro.locals` instead of passing it down via component props |
| 8 | + |
| 9 | + ⚠️ **Breaking change:** |
| 10 | + Previously, all of Starlight’s templating components, including user or plugin overrides, had access to a data object for the current route via `Astro.props`. |
| 11 | + This data is now available as `Astro.locals.starlightRoute` instead. |
| 12 | + |
| 13 | + To update, refactor any component overrides you have: |
| 14 | + |
| 15 | + - Remove imports of `@astrojs/starlight/props`, which is now deprecated. |
| 16 | + - Update code that accesses `Astro.props` to use `Astro.locals.starlightRoute` instead. |
| 17 | + - Remove any spreading of `{...Astro.props}` into child components, which is no longer required. |
| 18 | + |
| 19 | + In the following example, a custom override for Starlight’s `LastUpdated` component is updated for the new style: |
| 20 | + |
| 21 | + ```diff |
| 22 | + --- |
| 23 | + import Default from '@astrojs/starlight/components/LastUpdated.astro'; |
| 24 | + - import type { Props } from '@astrojs/starlight/props'; |
| 25 | + |
| 26 | + - const { lastUpdated } = Astro.props; |
| 27 | + + const { lastUpdated } = Astro.locals.starlightRoute; |
| 28 | + |
| 29 | + const updatedThisYear = lastUpdated?.getFullYear() === new Date().getFullYear(); |
| 30 | + --- |
| 31 | + |
| 32 | + {updatedThisYear && ( |
| 33 | + - <Default {...Astro.props}><slot /></Default> |
| 34 | + + <Default><slot /></Default> |
| 35 | + )} |
| 36 | + ``` |
| 37 | + |
| 38 | + _Community Starlight plugins may also need to be manually updated to work with Starlight 0.32. If you encounter any issues, please reach out to the plugin author to see if it is a known issue or if an updated version is being worked on._ |
| 39 | + |
| 40 | +- [#2578](https://github.com/withastro/starlight/pull/2578) [`f895f75`](https://github.com/withastro/starlight/commit/f895f75b17f36c826cc871ba1826e5ae1dff44ca) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Deprecates the Starlight plugin `setup` hook in favor of the new `config:setup` hook which provides the same functionality. |
| 41 | + |
| 42 | + ⚠️ **BREAKING CHANGE:** |
| 43 | + |
| 44 | + The Starlight plugin `setup` hook is now deprecated and will be removed in a future release. Please update your plugins to use the new `config:setup` hook instead. |
| 45 | + |
| 46 | + ```diff |
| 47 | + export default { |
| 48 | + name: 'plugin-with-translations', |
| 49 | + hooks: { |
| 50 | + - 'setup'({ config }) { |
| 51 | + + 'config:setup'({ config }) { |
| 52 | + // Your plugin configuration setup code |
| 53 | + }, |
| 54 | + }, |
| 55 | + }; |
| 56 | + ``` |
| 57 | + |
| 58 | +- [#2578](https://github.com/withastro/starlight/pull/2578) [`f895f75`](https://github.com/withastro/starlight/commit/f895f75b17f36c826cc871ba1826e5ae1dff44ca) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Exposes the built-in localization system in the Starlight plugin `config:setup` hook. |
| 59 | + |
| 60 | + ⚠️ **BREAKING CHANGE:** |
| 61 | + |
| 62 | + This addition changes how Starlight plugins add or update translation strings used in Starlight’s localization APIs. |
| 63 | + Plugins previously using the [`injectTranslations()`](https://starlight.astro.build/reference/plugins/#injecttranslations) callback function from the plugin [`config:setup`](https://starlight.astro.build/reference/plugins/#configsetup) hook should now use the same function available in the [`i18n:setup`](https://starlight.astro.build/reference/plugins/#i18nsetup) hook. |
| 64 | + |
| 65 | + ```diff |
| 66 | + export default { |
| 67 | + name: 'plugin-with-translations', |
| 68 | + hooks: { |
| 69 | + - 'config:setup'({ injectTranslations }) { |
| 70 | + + 'i18n:setup'({ injectTranslations }) { |
| 71 | + injectTranslations({ |
| 72 | + en: { |
| 73 | + 'myPlugin.doThing': 'Do the thing', |
| 74 | + }, |
| 75 | + fr: { |
| 76 | + 'myPlugin.doThing': 'Faire le truc', |
| 77 | + }, |
| 78 | + }); |
| 79 | + }, |
| 80 | + }, |
| 81 | + }; |
| 82 | + ``` |
| 83 | + |
| 84 | +- [#2858](https://github.com/withastro/starlight/pull/2858) [`2df9d05`](https://github.com/withastro/starlight/commit/2df9d05fe7b61282809aa85a1d77662fdd3b748f) Thanks [@XREvo](https://github.com/XREvo)! - Adds support for Pagefind’s multisite search features |
| 85 | + |
| 86 | +- [#2578](https://github.com/withastro/starlight/pull/2578) [`f895f75`](https://github.com/withastro/starlight/commit/f895f75b17f36c826cc871ba1826e5ae1dff44ca) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Adds a new [`HookParameters`](https://starlight.astro.build/reference/plugins/#hooks) utility type to get the type of a plugin hook’s arguments. |
| 87 | + |
| 88 | +- [#2578](https://github.com/withastro/starlight/pull/2578) [`f895f75`](https://github.com/withastro/starlight/commit/f895f75b17f36c826cc871ba1826e5ae1dff44ca) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Adds a new [`useTranslations()`](https://starlight.astro.build/reference/plugins/#usetranslations) callback function to the Starlight plugin `config:setup` hook to generate a utility function to access UI strings for a given language. |
| 89 | + |
| 90 | +- [#2578](https://github.com/withastro/starlight/pull/2578) [`f895f75`](https://github.com/withastro/starlight/commit/f895f75b17f36c826cc871ba1826e5ae1dff44ca) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Adds a new [`absolutePathToLang()`](https://starlight.astro.build/reference/plugins/#absolutepathtolang) callback function to the Starlight plugin `config:setup` to get the language for a given absolute file path. |
| 91 | + |
| 92 | +### Patch Changes |
| 93 | + |
| 94 | +- [#2848](https://github.com/withastro/starlight/pull/2848) [`9b32ba9`](https://github.com/withastro/starlight/commit/9b32ba967c5741354bc99ba0bcff3f454b8117ad) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fixes styling of [filter](https://pagefind.app/docs/filtering/) and [metadata](https://pagefind.app/docs/metadata/) elements in Pagefind search UI. |
| 95 | + |
3 | 96 | ## 0.31.1
|
4 | 97 |
|
5 | 98 | ### Patch Changes
|
|
0 commit comments