Skip to content

Commit c74d444

Browse files
authored
chore: migrate to Tailwind CSS v4.0 (#632)
* chore: migrate PostCSS configuration to v4 * chore: update dependencies in package.json and package-lock.json - Bump versions for autoprefixer, postcss, postcss-cli, prettier, and tailwindcss. - Remove unused dependencies to streamline the project. * chore: add @tailwindcss/postcss and update package-lock.json * fix: update import paths in CSS files for consistency * fix: change prefix from `hx-` to `hx:` * chore: migrate primary color theme variables to CSS * fix: remove unnecessary text decoration property from anchor styles in typography CSS * fix: update CSS styles for improved consistency and clarity across components * chore: clean up package.json and package-lock.json, remove unused dependencies, and update CSS imports for better organization * fix: bulk replace prefix `hx-` with `hx:` * fix: update tailwind css prefix * fix: styling consistent issues - steps counter fix in v4 - removed tailwind.css - update hr border colors - fix button cursor in v4 - fix border colors in various places * fix: update class prefixes for consistency in menu and sidebar components * fix: refine CSS classes and transitions for navbar and sidebar components - Updated hamburger menu styles for improved animation and structure. - Adjusted sidebar transition duration for smoother effects. - Standardized class prefixes for consistency across components. * fix: update border color in hero badge component for improved styling consistency * fix: update tab button cursor style for improved user interaction * chore: recompile css * fix: dark mode color not applied for before / after elements * fix: docs navigation * chore: recompile CSS * chore: update Tailwind CSS and PostCSS dependencies to version 4.0.17, recompile CSS, and add safelist * fix: typo in class name and add back decoration-from-font for typography a tags * fix: update class syntax for Tailwind CSS compatibility in mermaid code block
1 parent 32f7f6d commit c74d444

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1336
-6138
lines changed

Diff for: assets/css/compiled/main.css

+2-3,637
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: assets/css/components/badge.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
.hextra-badge {
2-
@apply hx-inline-flex hx-items-center;
2+
@apply hx:inline-flex hx:items-center;
33
}

Diff for: assets/css/components/code-copy.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
(-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))
33
) {
44
.hextra-code-copy-btn {
5-
@apply hx-backdrop-blur-md hx-bg-opacity-[.85] dark:hx-bg-opacity-80;
5+
@apply hx:backdrop-blur-md hx:opacity-85 hx:dark:opacity-80;
66
}
77
}

Diff for: assets/css/components/jupyter.css

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
.hextra-jupyter-code-cell {
22
scrollbar-gutter: auto;
33

4-
@apply hx-mt-6;
4+
@apply hx:mt-6;
55

66
.hextra-jupyter-code-cell-outputs-container {
7-
@apply hx-text-xs hx-overflow-hidden;
7+
@apply hx:text-xs hx:overflow-hidden;
88

99
.hextra-jupyter-code-cell-outputs {
10-
@apply hx-overflow-auto hx-max-h-[50vh];
10+
@apply hx:overflow-auto hx:max-h-[50vh];
1111

1212
pre {
13-
@apply hx-text-xs hx-overflow-auto hx-max-w-full;
13+
@apply hx:text-xs hx:overflow-auto hx:max-w-full;
1414
}
1515
}
1616
}

Diff for: assets/css/components/navbar.css

+35-40
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,50 @@
11
nav {
22
.search-wrapper {
3-
@apply hx-hidden md:hx-inline-block;
3+
@apply hx:hidden hx:md:inline-block;
44
}
55
}
66

77
@supports (
88
(-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))
99
) {
1010
.nav-container-blur {
11-
@apply hx-backdrop-blur-md hx-bg-white/[.85] dark:!hx-bg-dark/80;
11+
@apply hx:backdrop-blur-md hx:bg-white/[.85] hx:dark:bg-dark/80!;
1212
}
1313
}
1414

15-
.hamburger-menu svg {
16-
g {
17-
@apply hx-origin-center;
18-
transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1);
19-
}
20-
path {
21-
opacity: 1;
22-
transition:
23-
transform 0.2s cubic-bezier(0.25, 1, 0.5, 1) 0.2s,
24-
opacity 0.2s ease 0.2s;
25-
}
15+
/* Hamburger Menu - Flattened Structure */
16+
.hamburger-menu svg g {
17+
@apply hx:origin-center hx:transition-all hx:duration-100 hx:ease-out;
18+
}
2619

27-
&.open {
28-
path {
29-
transition:
30-
transform 0.2s cubic-bezier(0.25, 1, 0.5, 1),
31-
opacity 0s ease 0.2s;
32-
}
33-
g {
34-
transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1) 0.2s;
35-
}
36-
}
20+
.hamburger-menu svg path {
21+
@apply hx:opacity-100 hx:transition-all hx:duration-100 hx:ease-out hx:delay-100;
22+
}
3723

38-
&.open > {
39-
path {
40-
@apply hx-opacity-0;
41-
}
42-
g:nth-of-type(1) {
43-
@apply hx-rotate-45;
44-
path {
45-
transform: translate3d(0, 4px, 0);
46-
}
47-
}
48-
g:nth-of-type(2) {
49-
@apply -hx-rotate-45;
50-
path {
51-
transform: translate3d(0, -4px, 0);
52-
}
53-
}
54-
}
24+
.hamburger-menu svg.open path {
25+
@apply hx:transition-transform hx:duration-100 hx:ease-out hx:delay-0;
26+
}
27+
28+
.hamburger-menu svg.open g {
29+
@apply hx:transition-transform hx:duration-100 hx:ease-out hx:delay-100;
30+
}
31+
32+
.hamburger-menu svg.open > path {
33+
@apply hx:opacity-0;
34+
}
35+
36+
.hamburger-menu svg.open > g:nth-of-type(1) {
37+
@apply hx:rotate-45;
38+
}
39+
40+
.hamburger-menu svg.open > g:nth-of-type(1) path {
41+
@apply hx:translate-y-1;
42+
}
43+
44+
.hamburger-menu svg.open > g:nth-of-type(2) {
45+
@apply hx:-rotate-45;
46+
}
47+
48+
.hamburger-menu svg.open > g:nth-of-type(2) path {
49+
@apply hx:-translate-y-1;
5550
}

Diff for: assets/css/components/scrollbar.css

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44

55
scrollbar-gutter: stable;
66
&::-webkit-scrollbar {
7-
@apply hx-w-3 hx-h-3;
7+
@apply hx:w-3 hx:h-3;
88
}
99
&::-webkit-scrollbar-track {
10-
@apply hx-bg-transparent;
10+
@apply hx:bg-transparent;
1111
}
1212
&::-webkit-scrollbar-thumb {
13-
@apply hx-rounded-[10px];
13+
@apply hx:rounded-[10px];
1414
}
1515
&:hover::-webkit-scrollbar-thumb {
1616
border: 3px solid transparent;
1717
background-color: var(--tw-shadow-color);
1818
background-clip: content-box;
19-
@apply hx-shadow-neutral-500/20 hover:hx-shadow-neutral-500/40;
19+
@apply hx:shadow-neutral-500/20 hx:hover:shadow-neutral-500/40;
2020
}
2121
}

Diff for: assets/css/components/search.css

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
.search-wrapper {
22
li {
3-
@apply hx-mx-2.5 hx-break-words hx-rounded-md contrast-more:hx-border hx-text-gray-800 contrast-more:hx-border-transparent dark:hx-text-gray-300;
3+
@apply hx:mx-2.5 hx:break-words hx:rounded-md hx:contrast-more:border hx:text-gray-800 hx:contrast-more:border-transparent hx:dark:text-gray-300;
44
a {
5-
@apply hx-block hx-scroll-m-12 hx-px-2.5 hx-py-2;
5+
@apply hx:block hx:scroll-m-12 hx:px-2.5 hx:py-2;
66
}
77

88
.title {
9-
@apply hx-text-base hx-font-semibold hx-leading-5;
9+
@apply hx:text-base hx:font-semibold hx:leading-5;
1010
}
1111

1212
.active {
13-
@apply hx-rounded-md hx-bg-primary-500/10 contrast-more:hx-border-primary-500;
13+
@apply hx:rounded-md hx:bg-primary-500/10 hx:contrast-more:border-primary-500;
1414
}
1515
}
1616

1717
.no-result {
18-
@apply hx-block hx-select-none hx-p-8 hx-text-center hx-text-sm hx-text-gray-400;
18+
@apply hx:block hx:select-none hx:p-8 hx:text-center hx:text-sm hx:text-gray-400;
1919
}
2020

2121
.prefix {
22-
@apply hx-mx-2.5 hx-mb-2 hx-mt-6 hx-select-none hx-border-b hx-border-black/10 hx-px-2.5 hx-pb-1.5 hx-text-xs hx-font-semibold
23-
hx-uppercase hx-text-gray-500 first:hx-mt-0 dark:hx-border-white/20 dark:hx-text-gray-300 contrast-more:hx-border-gray-600
24-
contrast-more:hx-text-gray-900 contrast-more:dark:hx-border-gray-50 contrast-more:dark:hx-text-gray-50;
22+
@apply hx:mx-2.5 hx:mb-2 hx:mt-6 hx:select-none hx:border-b hx:border-black/10 hx:px-2.5 hx:pb-1.5 hx:text-xs hx:font-semibold
23+
hx:uppercase hx:text-gray-500 hx:first:mt-0 hx:dark:border-white/20 hx:dark:text-gray-300 hx:contrast-more:border-gray-600
24+
hx:contrast-more:text-gray-900 hx:contrast-more:dark:border-gray-50 hx:contrast-more:dark:text-gray-50;
2525
}
2626

2727
.excerpt {
28-
@apply hx-overflow-hidden hx-text-ellipsis hx-mt-1 hx-text-sm hx-leading-[1.35rem] hx-text-gray-600 dark:hx-text-gray-400 contrast-more:dark:hx-text-gray-50;
28+
@apply hx:overflow-hidden hx:text-ellipsis hx:mt-1 hx:text-sm hx:leading-[1.35rem] hx:text-gray-600 hx:dark:text-gray-400 hx:contrast-more:dark:text-gray-50;
2929
display: -webkit-box;
3030
line-clamp: 1;
3131
-webkit-line-clamp: 1;
3232
-webkit-box-orient: vertical;
3333
}
3434

3535
.match {
36-
@apply hx-text-primary-600;
36+
@apply hx:text-primary-600;
3737
}
3838
}

Diff for: assets/css/components/sidebar.css

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
@media (max-width: 767px) {
1+
@media (max-width: 48rem) {
22
.sidebar-container {
3-
@apply hx-fixed hx-pt-[calc(var(--navbar-height))] hx-top-0 hx-w-full hx-bottom-0 hx-z-[15] hx-overscroll-contain hx-bg-white dark:hx-bg-dark;
4-
transition: transform 0.8s cubic-bezier(0.52, 0.16, 0.04, 1);
3+
@apply hx:fixed hx:pt-[calc(var(--navbar-height))] hx:top-0 hx:w-full hx:bottom-0 hx:z-[15] hx:overscroll-contain hx:bg-white hx:dark:bg-dark;
4+
transition: transform 0.4s cubic-bezier(0.52, 0.16, 0.04, 1);
55
will-change: transform, opacity;
66
contain: layout style;
77
backface-visibility: hidden;
@@ -10,12 +10,12 @@
1010

1111
.sidebar-container {
1212
li > div {
13-
@apply hx-h-0;
13+
@apply hx:h-0;
1414
}
1515
li.open > div {
16-
@apply hx-h-auto hx-pt-1;
16+
@apply hx:h-auto hx:pt-1;
1717
}
1818
li.open > a > span > svg > path {
19-
@apply hx-rotate-90;
19+
@apply hx:rotate-90;
2020
}
2121
}

Diff for: assets/css/components/steps.css

+17-12
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
1-
.steps h3 {
2-
counter-increment: step;
3-
4-
&:before {
5-
@apply hx-absolute hx-w-[33px] hx-h-[33px];
6-
@apply hx-border-4 hx-border-white hx-bg-gray-100 dark:hx-border-dark dark:hx-bg-neutral-800;
7-
@apply hx-rounded-full hx-text-neutral-400 hx-text-base hx-font-normal hx-text-center -hx-indent-px;
8-
@apply hx-mt-[3px] ltr:hx-ml-[-41px] rtl:hx-mr-[-44px];
9-
content: counter(step);
1+
.steps {
2+
:where(h2, h3, h4, h5, h6):not(.no-step-marker) {
3+
counter-increment: step;
4+
@apply hx:ltr:before:ml-[-41px] hx:rtl:before:mr-[-44px];
5+
/* https://github.com/tailwindlabs/tailwindcss/issues/15597#issuecomment-2582673546 */
6+
@apply hx:before:bg-gray-100 hx:dark:before:bg-neutral-800;
7+
@apply hx:before:border-4 hx:before:border-white hx:dark:before:border-dark;
8+
&:before {
9+
content: counter(step);
10+
@apply hx:absolute hx:size-[33px];
11+
@apply hx:rounded-full hx:text-neutral-400 hx:text-base hx:font-normal hx:text-center hx:-indent-px;
12+
}
1013
}
1114
}
1215

13-
:lang(fa) .steps h3 {
14-
&:before {
15-
content: counter(step, persian);
16+
:lang(fa) .steps {
17+
:where(h2, h3, h4, h5, h6):not(.no-step-marker) {
18+
&:before {
19+
content: counter(step, persian);
20+
}
1621
}
1722
}

Diff for: assets/css/highlight.css

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
11
/* Code syntax highlight */
2-
@import "chroma/light.css";
3-
@import "chroma/dark.css";
2+
@import "./chroma/light.css";
3+
@import "./chroma/dark.css";
44

55
.hextra-code-block {
6-
@apply hx-text-[.9em] hx-leading-5;
6+
@apply hx:text-[.9em] hx:leading-5;
77

88
pre {
9-
@apply hx-text-[.9em] hx-bg-primary-700/5 hx-overflow-x-auto hx-font-medium hx-subpixel-antialiased dark:hx-bg-primary-300/10 contrast-more:hx-border contrast-more:hx-border-primary-900/20 contrast-more:hx-contrast-150 contrast-more:dark:hx-border-primary-100/40;
9+
@apply hx:text-[.9em] hx:bg-primary-700/5 hx:overflow-x-auto hx:font-medium hx:subpixel-antialiased hx:dark:bg-primary-300/10 hx:contrast-more:border hx:contrast-more:border-primary-900/20 hx:contrast-more:contrast-150 hx:contrast-more:dark:border-primary-100/40;
1010
}
1111

1212
.filename {
13-
@apply hx-absolute hx-top-0 hx-z-[1] hx-w-full hx-truncate hx-rounded-t-xl hx-bg-primary-700/5 hx-py-2 hx-px-4 hx-text-xs hx-text-gray-700 dark:hx-bg-primary-300/10 dark:hx-text-gray-200;
13+
@apply hx:absolute hx:top-0 hx:z-[1] hx:w-full hx:truncate hx:rounded-t-xl hx:bg-primary-700/5 hx:py-2 hx:px-4 hx:text-xs hx:text-gray-700 hx:dark:bg-primary-300/10 hx:dark:text-gray-200;
1414
}
1515

1616
.filename + pre:not(.lntable pre) {
1717
/* Override padding for code blocks with filename but no highlight */
18-
@apply hx-pt-12;
18+
@apply hx:pt-12;
1919
}
2020
}
2121

2222
.hextra-code-block pre:not(.lntable pre) {
23-
@apply hx-px-4 hx-mb-4 hx-py-4 hx-rounded-xl;
23+
@apply hx:px-4 hx:mb-4 hx:py-4 hx:rounded-xl;
2424
}
2525

2626
.hextra-code-block div:nth-of-type(2) pre {
27-
@apply hx-pt-12 hx-pb-4;
27+
@apply hx:pt-12 hx:pb-4;
2828
}
2929

3030
.chroma {
3131
.lntable {
32-
@apply hx-m-0 hx-block hx-w-auto hx-overflow-auto hx-rounded-xl;
32+
@apply hx:m-0 hx:block hx:w-auto hx:overflow-auto hx:rounded-xl;
3333

3434
pre {
35-
@apply hx-pt-4 hx-pb-4;
35+
@apply hx:pt-4 hx:pb-4;
3636
}
3737
}
3838
.ln,
3939
.lnt:not(.hl > .lnt),
4040
.hl:not(.line) {
41-
@apply hx-pl-4 hx-pr-4 hx-min-w-[2.6rem] hx-text-neutral-600 dark:hx-text-neutral-300;
41+
@apply hx:pl-4 hx:pr-4 hx:min-w-[2.6rem] hx:text-neutral-600 hx:dark:text-neutral-300;
4242
}
4343
.lntd {
44-
@apply hx-p-0 hx-align-top;
44+
@apply hx:p-0 hx:align-top;
4545
}
4646
.lntd:last-of-type {
47-
@apply hx-w-full;
47+
@apply hx:w-full;
4848
}
4949
/* LineHighlight */
5050
.hl {
51-
@apply hx-block hx-w-full hx-bg-primary-800/10;
51+
@apply hx:block hx:w-full hx:bg-primary-800/10;
5252
}
5353
}

Diff for: assets/css/safelist.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hx:max-w-full

Diff for: assets/css/styles.css

+31-17
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1-
@import "tailwind.css";
1+
@import "tailwindcss" prefix(hx);
22

3-
@import "typography.css";
4-
@import "highlight.css";
5-
@import "components/cards.css";
6-
@import "components/steps.css";
7-
@import "components/search.css";
8-
@import "components/sidebar.css";
9-
@import "components/navbar.css";
10-
@import "components/scrollbar.css";
11-
@import "components/code-copy.css";
12-
@import "components/hextra/feature-grid.css";
13-
@import "components/jupyter.css";
14-
@import "components/badge.css";
3+
@custom-variant dark (&:where(.dark, .dark *));
4+
5+
@theme {
6+
--color-primary-50: hsl(var(--primary-hue) var(--primary-saturation) calc(var(--primary-lightness) + calc(calc(100% - var(--primary-lightness)) / 50) * 47));
7+
--color-primary-100: hsl(var(--primary-hue) var(--primary-saturation) calc(var(--primary-lightness) + calc(calc(100% - var(--primary-lightness)) / 50) * 44));
8+
--color-primary-200: hsl(var(--primary-hue) var(--primary-saturation) calc(var(--primary-lightness) + calc(calc(100% - var(--primary-lightness)) / 50) * 36));
9+
--color-primary-300: hsl(var(--primary-hue) var(--primary-saturation) calc(var(--primary-lightness) + calc(calc(100% - var(--primary-lightness)) / 50) * 27));
10+
--color-primary-400: hsl(var(--primary-hue) var(--primary-saturation) calc(var(--primary-lightness) + calc(calc(100% - var(--primary-lightness)) / 50) * 16));
11+
--color-primary-500: hsl(var(--primary-hue) var(--primary-saturation) var(--primary-lightness));
12+
--color-primary-600: hsl(var(--primary-hue) var(--primary-saturation) calc(calc(var(--primary-lightness) / 50) * 45));
13+
--color-primary-700: hsl(var(--primary-hue) var(--primary-saturation) calc(calc(var(--primary-lightness) / 50) * 39));
14+
--color-primary-800: hsl(var(--primary-hue) var(--primary-saturation) calc(calc(var(--primary-lightness) / 50) * 32));
15+
--color-primary-900: hsl(var(--primary-hue) var(--primary-saturation) calc(calc(var(--primary-lightness) / 50) * 24));
16+
--color-dark: #111;
17+
}
1518

1619
html {
17-
@apply hx-text-base hx-antialiased;
18-
font-feature-settings: "rlig" 1, "calt" 1, "ss01" 1;
19-
-webkit-tap-highlight-color: transparent;
20+
@apply hx:text-base hx:antialiased;
2021
}
2122

2223
body {
23-
@apply hx-w-full hx-bg-white dark:hx-bg-dark dark:hx-text-gray-100;
24+
@apply hx:w-full hx:bg-white hx:dark:bg-dark hx:dark:text-gray-100;
2425
}
2526

2627
:root {
@@ -36,3 +37,16 @@ body {
3637
--primary-saturation: 100%;
3738
--primary-lightness: 50%;
3839
}
40+
41+
@import "./typography.css";
42+
@import "./highlight.css";
43+
@import "./components/cards.css";
44+
@import "./components/steps.css";
45+
@import "./components/search.css";
46+
@import "./components/sidebar.css";
47+
@import "./components/navbar.css";
48+
@import "./components/scrollbar.css";
49+
@import "./components/code-copy.css";
50+
@import "./components/hextra/feature-grid.css";
51+
@import "./components/jupyter.css";
52+
@import "./components/badge.css";

Diff for: assets/css/tailwind.css

-3
This file was deleted.

0 commit comments

Comments
 (0)