Skip to content

Commit cd67b77

Browse files
committed
reduce bundle as much as we can
1 parent 3018e62 commit cd67b77

File tree

4 files changed

+35
-21
lines changed

4 files changed

+35
-21
lines changed

astro/components/Benchmarks.astro

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,17 @@
125125
</style>
126126

127127
<script>
128-
import Chart from "chart.js/auto";
128+
import {
129+
Chart,
130+
BarController,
131+
BarElement,
132+
CategoryScale,
133+
LinearScale,
134+
Legend,
135+
Tooltip,
136+
} from "chart.js";
137+
138+
Chart.register(BarController, BarElement, CategoryScale, LinearScale, Legend, Tooltip);
129139

130140
function getChartColors() {
131141
const style = getComputedStyle(document.documentElement);

astro/components/SiteTitle.astro

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ function pathsMatch(lhs: string, rhs: string): boolean {
1313
}
1414
---
1515

16-
<div>
16+
<div class="site-title-wrapper">
1717
<AstrolightSiteTitle {...Astro.props} />
1818

1919
<div class="separator"></div>
2020

21-
<nav aria-label="Main navigation">
21+
<nav class="site-title-nav" aria-label="Main navigation">
2222
{
2323
menuItems.map((menuItem) => (
2424
<a
@@ -35,26 +35,20 @@ function pathsMatch(lhs: string, rhs: string): boolean {
3535
</div>
3636

3737
<style>
38-
div {
39-
display: flex;
40-
gap: var(--sl-content-pad-x);
41-
align-items: center;
42-
}
43-
4438
.separator {
4539
content: "";
4640
height: 1.5rem;
4741
border-inline-end: 1px solid var(--sl-color-gray-4);
4842
}
4943

50-
div a {
44+
.site-title-wrapper a {
5145
text-decoration: none;
5246
color: var(--sl-color-white);
5347
font-size: var(--sl-text-base);
5448
font-weight: 500;
5549
}
5650

57-
div a:hover {
51+
.site-title-wrapper a:hover {
5852
text-decoration: underline;
5953
color: var(--sl-color-text-accent);
6054
}
@@ -64,13 +58,4 @@ function pathsMatch(lhs: string, rhs: string): boolean {
6458
[aria-current="page"]:focus {
6559
color: var(--sl-color-text-accent);
6660
}
67-
68-
@media (min-width: 50rem) {
69-
nav {
70-
display: flex;
71-
}
72-
.separator {
73-
display: block;
74-
}
75-
}
7661
</style>

astro/components/playground/Playground.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ import { Toaster } from './ui/toaster'
44
---
55

66
<PlaygroundForm client:load />
7-
<Toaster client:load />
7+
<Toaster client:idle />

astro/custom.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,22 @@
55
:root[data-theme="light"] {
66
--sl-color-toast-red: #dc2626;
77
}
8+
9+
/* SiteTitle layout — kept here (render-blocking) to prevent FOUC in dev mode */
10+
.site-title-wrapper {
11+
display: flex;
12+
gap: 1rem;
13+
align-items: center;
14+
}
15+
16+
.site-title-nav {
17+
display: flex;
18+
gap: 1rem;
19+
}
20+
21+
@media (min-width: 72rem) {
22+
.site-title-wrapper,
23+
.site-title-nav {
24+
gap: 1.5rem;
25+
}
26+
}

0 commit comments

Comments
 (0)