Conversation
🦋 Changeset detectedLatest commit: 6928271 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for astro-starlight ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
|
Copying @mayank99 in on this PR! Will try to take a look soon. |
mayank99
left a comment
There was a problem hiding this comment.
Excited to see this!
I'll try to take a deeper look when I have some time. For now I've just left one question.
|
Small note that Tailwind CSS v4.0 Beta adds native CSS cascade layers support. |
|
Tailwind v4's layer implementation has good and bad parts. The bad: they implicitly create very generic layer names (i.e. not namespaced). The good: they allow control over importing their stylesheets(s) so you can put their layers inside your own layer or even change the names. @import "tailwindcss" layer(💨);
/* or */
@import "tailwindcss/base" layer(💨base);
@import "tailwindcss/theme" layer(💨theme);
@import "tailwindcss/utilities" layer(💨utilities); |
* main: (493 commits) i18n(de): update `sidebar.mdx` (withastro#2900) Adding all samples for badges in sidebar as example (withastro#2881) i18n(fr): fix highlighting in `reference/plugins.md` (withastro#2898) i18n(fr): update `reference/plugins` & `guides/i18n` (withastro#2886) i18n(fr): update `reference/overrides` & `guides/sidebar` (withastro#2887) i18n(fr): add `guides/route-data` and `reference/route-data` (withastro#2884) i18n(fr): update `guides/overriding-components` (withastro#2885) i18n(fr): update `reference/configuration` (withastro#2888) i18n(de): update German translation with withastro#2578 (withastro#2882) [ci] format i18n(ru): update some translations (withastro#2895) i18n(de): update `reference/configuration.mdx` (withastro#2883) [ci] format i18n(ko-KR): update `configuration.mdx` (withastro#2892) i18n(ko-KR): update `overrides.md` (withastro#2893) i18n(ko-KR): update `overriding-components.mdx` (withastro#2890) i18n(ko-KR): update `i18n.mdx` and `plugins.md` (withastro#2889) [ci] format i18n(ko-KR): create `guides/route-data.mdx` and `reference/route-data.mdx` (withastro#2896) i18n(ko-KR): update `/resources/plugins.mdx` (withastro#2894) ...
mayank99
left a comment
There was a problem hiding this comment.
Finally got the chance to try it out, and I'm happy to report it's working great! 🥳
When I used customCss, I found that the stylesheet was linked before Starlight's own CSS. I'm not sure if this behavior is intentional and will remain this way, but it works out great for the layer use-case.
For extra surety, I also tried overriding Starlight's Head component and it worked as expected for placing an inline <style> tag with my predefined layer order before all other <head> content.
Co-authored-by: Mayank <9084735+mayank99@users.noreply.github.com>
* main: (31 commits) [ci] release (withastro#3091) i18n(de): update `environmental-impact` (withastro#3112) feat: update environment comparisons data (withastro#3097) chore(deps): update actions/setup-node action to v4.4.0 (withastro#3111) Update Expressive Code and related packages (withastro#3109) i18n(de): update `reference/overrides.md` (withastro#3093) i18n(de): update `reference/route-data.mdx` (withastro#3094) i18n(de): update `resources/themes.mdx` (withastro#3092) [ci] format i18n(zh-cn): Update configuration.mdx (withastro#3102) i18n(zh-cn): Update overrides.mdx (withastro#3103) [ci] format i18n(zh-cn): Add route-data.mdx (withastro#3106) [ci] format i18n(zh-cn): Add themes.mdx (withastro#3105) [ci] format i18n(zh-cn): Update plugins.md (withastro#3104) [ci] format i18n(zh-cn): Update customization.mdx (withastro#3101) i18n(zh-cn): Update badges.mdx (withastro#3100) ...
There was a problem hiding this comment.
I’m too sleepy to fully tackle the docs — will do those tomorrow morning — but getting in at least a review on all the code changes.
Amazing work as always @HiDeoo and I haven’t spotted anything major I don’t think!
- See if we should remove the default scoped style strategy enforced by Starlight?
I was also wondering that the other day, but I agree with you that this PR already has enough going on 😁
We could definitely reuse your visual diff script for that PR when the time comes though!
Co-authored-by: Chris Swithinbank <357379+delucis@users.noreply.github.com>
Co-authored-by: Chris Swithinbank <357379+delucis@users.noreply.github.com>
Co-authored-by: Chris Swithinbank <357379+delucis@users.noreply.github.com>
Co-authored-by: Chris Swithinbank <357379+delucis@users.noreply.github.com>
delucis
left a comment
There was a problem hiding this comment.
Last few remarks on the changesets. Will looks at docs now.
Co-authored-by: Chris Swithinbank <357379+delucis@users.noreply.github.com>
delucis
left a comment
There was a problem hiding this comment.
I think this PR is in great shape to merge in our next minor! Many, many thanks to @HiDeoo for iterating over this and getting us to this point. In some ways this is a big architectural change but you’ve carried it out with such care that I think most people will hardly notice, while unlocking lots of improvements for those who need it.
* main: [ci] release (withastro#3124) Fix E2E tests broken by formatter [ci] format Add built-in heading anchor link support (withastro#3033) i18n(fr): update `environmental-impact` (withastro#3123) Cascade Layers (withastro#2322) Fix image metadata validation in StarlightPage schema (withastro#3118) Don’t set defaults for `attrs` and `content` in head entries (withastro#3122) [ci] format i18n(es) Translate `route-data` (withastro#3071)
Co-authored-by: Matthew Justice <72817096+JusticeMatthew@users.noreply.github.com> Co-authored-by: Mark Gaze <16718355+markgaze@users.noreply.github.com> Co-authored-by: Mayank <9084735+mayank99@users.noreply.github.com> Co-authored-by: Chris Swithinbank <357379+delucis@users.noreply.github.com> Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

Description
This PR is a WIP that refactors all Starlight CSS to use cascade layers.
At the moment, Starlight will internally uses the following nested layers:
starlight.basestarlight.resetstarlight.corestarlight.contentstarlight.componentsstarlight.utilsThis slightly reduces browser support by 0.3% (
Chrome >= 88→Chrome >= 99).Testing
As I quickly realized that manually inspecting would not be practical for this PR to ensure there are no regressions, I created a new temporary package to help test the changes (
packages/local-prod-visual-diff) that can be run usingpnpm testfrom that directory.For a list of routes, the tool will:
This has been very helpful to spot some tiny issues during the refactor, e.g. the following diff image that shows a tiny difference in the header
<Select>component icons:Another one showing an issue with the content of the last step in a set of
<Steps>:Of course, this is only a bonus and this PR would still be a good Talking & Doc'ing candidate with many different eyes/browsers.
Remaining tasks
Figure out if we should namespace the Tailwind layers, e.g.tailwind.baselike we do at the moment for Starlight or if we should just use the default layers (not doing that)TODO(HiDeoo)comment in thedocs/astro.config.mjsfilepackages/local-prod-visual-diffpackageSee if we should remove the default scoped style strategy enforced by Starlight? (not doing that)We would need to refactor various components to handledata-astro-cid-*attributes. Not confident this PR is the right place to do that.