refactor(css): add prefix to component classes for consistency (#744)

* refactor(navbar): add hextra prefix to navbar and hamburger menu classes

- Updated CSS class names from `nav-container` to `hextra-nav-container` and `hamburger-menu` to `hextra-hamburger-menu` for improved clarity and consistency across the project.
- Adjusted related JavaScript and documentation to reflect the new class names.

* refactor(search): update class names for search components

- Renamed CSS classes from `search-wrapper`, `search-input`, `active`, `no-result`, `prefix`, `excerpt`, and `match` to `hextra-search-wrapper`, `hextra-search-input`, `hextra-search-active`, `hextra-search-no-result`, `hextra-search-prefix`, `hextra-search-excerpt`, and `hextra-search-match` for improved clarity and consistency.
- Updated JavaScript selectors to match the new class names, ensuring functionality remains intact.
- Adjusted HTML structure to reflect the new class naming convention.

* refactor(search): update search component class names for consistency

- Renamed existing search-related CSS classes to include the `hextra` prefix for improved clarity and consistency.
- Added optional nested classes for enhanced customization of the search UI, including titles, active states, and result snippets.
- Removed outdated breadcrumb section as no specific class is available.

* refactor(sidebar): rename sidebar classes for consistency

- Updated CSS and JavaScript to replace `sidebar-container` with `hextra-sidebar-container` and `sidebar-active-item` with `hextra-sidebar-active-item` for improved clarity and consistency across the project.
- Adjusted related documentation to reflect the new class names.

* refactor(language & theme): update class names for consistency

- Renamed language switcher and theme toggle classes to include the `hextra` prefix for improved clarity and consistency across the project.
- Updated related JavaScript selectors and documentation to reflect the new class names.

* refactor(css & html): rename classes for consistency and clarity

- Updated various CSS class names to include the `hextra` prefix, enhancing consistency across the project. This includes renaming classes such as `content` to `hextra-content`, `filename` to `hextra-code-filename`, and `steps` to `hextra-steps`.
- Adjusted related HTML and JavaScript to reflect the new class names, ensuring functionality and styling remain intact.
- Updated documentation to include the new class names for better clarity.

* refactor(language): update class names for language options

- Renamed the `language-options` class to `hextra-language-options` for consistency with the existing `hextra` prefix convention.
- Updated the corresponding HTML to reflect the new class name, ensuring clarity and uniformity across the project.

* refactor(css & html): rename classes for consistency and clarity

- Renamed CSS classes to include the `hextra` prefix, such as changing `subheading-anchor` to `hextra-subheading-anchor` and `footnotes` to `hextra-footnotes`, enhancing consistency across the project.
- Updated related HTML and documentation to reflect the new class names, ensuring clarity and uniformity.

* feat(typography): add styling for horizontal lines

- Introduced new styles for horizontal lines to enhance visual separation in content. The styles apply margin and border color adjustments, ensuring consistency with the overall design.

* feat(blog): add draft release announcement for Hextra v0.10.0

- Created a new markdown file for the draft release announcement of Hextra v0.10.0, including upgrade instructions and author details.
- The announcement is currently marked as a draft and may be updated before the official release.

* refactor(css & html): rename `hextra-content` class to `content` for consistency

- Updated the `hextra-content` class to simply `content` across various HTML files and CSS, enhancing clarity and consistency in the codebase.
- Adjusted the `package.json` script for the development server to include the `-F` flag for better functionality.

* refactor(typography & markdown): enhance table styling and markdown syntax

- Updated CSS for tables to improve styling, including adjustments to margins, borders, and text properties for better readability.
- Revised markdown documentation to standardize table formatting and improve clarity, including consistent syntax for headers and lists.
- Enhanced examples in the documentation to reflect the updated styling and ensure accurate representation of output.

* fix(blog): update text color for improved accessibility

- Modified the text color in the blog single layout to enhance readability in dark mode by adding a dark text color class.
- Ensured consistency in styling for better user experience across different themes.

* docs(blog): update draft release announcement for Hextra v0.10.0

- Revised the "What's New" section to include a TODO placeholder for future updates.
- Added a comprehensive migration guide detailing the CSS class prefix changes to enhance consistency and avoid conflicts.
- Updated the announcement to reflect the new class naming conventions for various components.

* chore: rebuild css
This commit is contained in:
Xin
2025-08-13 22:55:38 +08:00
committed by GitHub
parent 953042a0c0
commit 6823cc1fe8
30 changed files with 274 additions and 205 deletions

File diff suppressed because one or more lines are too long

View File

@@ -7,44 +7,44 @@ nav {
@supports (
(-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))
) {
.nav-container-blur {
.hextra-nav-container-blur {
@apply hx:backdrop-blur-md hx:bg-white/[.85] hx:dark:bg-dark/80!;
}
}
/* Hamburger Menu - Flattened Structure */
.hamburger-menu svg g {
.hextra-hamburger-menu svg g {
@apply hx:origin-center hx:transition-all hx:duration-100 hx:ease-out;
}
.hamburger-menu svg path {
.hextra-hamburger-menu svg path {
@apply hx:opacity-100 hx:transition-all hx:duration-100 hx:ease-out hx:delay-100;
}
.hamburger-menu svg.open path {
.hextra-hamburger-menu svg.open path {
@apply hx:transition-transform hx:duration-100 hx:ease-out hx:delay-0;
}
.hamburger-menu svg.open g {
.hextra-hamburger-menu svg.open g {
@apply hx:transition-transform hx:duration-100 hx:ease-out hx:delay-100;
}
.hamburger-menu svg.open > path {
.hextra-hamburger-menu svg.open > path {
@apply hx:opacity-0;
}
.hamburger-menu svg.open > g:nth-of-type(1) {
.hextra-hamburger-menu svg.open > g:nth-of-type(1) {
@apply hx:rotate-45;
}
.hamburger-menu svg.open > g:nth-of-type(1) path {
.hextra-hamburger-menu svg.open > g:nth-of-type(1) path {
@apply hx:translate-y-1;
}
.hamburger-menu svg.open > g:nth-of-type(2) {
.hextra-hamburger-menu svg.open > g:nth-of-type(2) {
@apply hx:-rotate-45;
}
.hamburger-menu svg.open > g:nth-of-type(2) path {
.hextra-hamburger-menu svg.open > g:nth-of-type(2) path {
@apply hx:-translate-y-1;
}

View File

@@ -1,30 +1,30 @@
.search-wrapper {
.hextra-search-wrapper {
li {
@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;
a {
@apply hx:block hx:scroll-m-12 hx:px-2.5 hx:py-2;
}
.title {
.hextra-search-title {
@apply hx:text-base hx:font-semibold hx:leading-5;
}
.active {
.hextra-search-active {
@apply hx:rounded-md hx:bg-primary-500/10 hx:contrast-more:border-primary-500;
}
}
.no-result {
.hextra-search-no-result {
@apply hx:block hx:select-none hx:p-8 hx:text-center hx:text-sm hx:text-gray-400;
}
.prefix {
.hextra-search-prefix {
@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
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
hx:contrast-more:text-gray-900 hx:contrast-more:dark:border-gray-50 hx:contrast-more:dark:text-gray-50;
}
.excerpt {
.hextra-search-excerpt {
@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;
display: -webkit-box;
line-clamp: 1;
@@ -32,7 +32,7 @@
-webkit-box-orient: vertical;
}
.match {
.hextra-search-match {
@apply hx:text-primary-600;
}
}

View File

@@ -1,5 +1,5 @@
@media (max-width: 48rem) {
.sidebar-container {
.hextra-sidebar-container {
@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;
transition: transform 0.4s cubic-bezier(0.52, 0.16, 0.04, 1);
will-change: transform, opacity;
@@ -8,7 +8,7 @@
}
}
.sidebar-container {
.hextra-sidebar-container {
li > div {
@apply hx:h-0;
}

View File

@@ -1,4 +1,4 @@
.steps {
.hextra-steps {
:where(h2, h3, h4, h5, h6):not(.no-step-marker) {
counter-increment: step;
@apply hx:ltr:before:ml-[-41px] hx:rtl:before:mr-[-44px];
@@ -13,7 +13,7 @@
}
}
:lang(fa) .steps {
:lang(fa) .hextra-steps {
:where(h2, h3, h4, h5, h6):not(.no-step-marker) {
&:before {
content: counter(step, persian);

View File

@@ -9,11 +9,11 @@
@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;
}
.filename {
.hextra-code-filename {
@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;
}
.filename + pre:not(.lntable pre) {
.hextra-code-filename + pre:not(.lntable pre) {
/* Override padding for code blocks with filename but no highlight */
@apply hx:pt-12;
}

View File

@@ -33,16 +33,19 @@
@apply hx:border-black/4 hx:bg-black/3 hx:break-words hx:rounded-md hx:border hx:py-0.5 hx:px-[.25em] hx:text-[.9em] hx:dark:border-white/10 hx:dark:bg-white/10;
}
:where(table):not(:where(.hextra-code-block table, [class~=not-prose],[class~=not-prose] *)) {
@apply hx:block hx:overflow-x-auto hx:mt-6 hx:p-0 hx:first:mt-0;
@apply hx:block hx:overflow-x-auto hx:my-6 hx:p-0 hx:first:mt-0 hx:w-full hx:text-sm hx:leading-5;
tr {
@apply hx:m-0 hx:border-t hx:border-gray-300 hx:p-0 hx:dark:border-gray-600 hx:even:bg-gray-100 hx:even:dark:bg-gray-600/20;
thead {
@apply hx:border-b hx:border-gray-200 hx:dark:border-neutral-800;
}
tbody tr {
@apply hx:m-0 hx:border-b hx:border-gray-100 hx:dark:border-neutral-800/50;
}
th {
@apply hx:m-0 hx:border hx:border-gray-300 hx:px-4 hx:py-2 hx:font-semibold hx:dark:border-gray-600;
@apply hx:m-0 hx:p-2 hx:font-semibold hx:first:pl-0 hx:last:pr-0;
}
td {
@apply hx:m-0 hx:border hx:border-gray-300 hx:px-4 hx:py-2 hx:dark:border-gray-600;
@apply hx:m-0 hx:p-2 hx:first:pl-0 hx:last:pr-0;
}
}
:where(ol):not(:where([class~=not-prose],[class~=not-prose] *)) {
@@ -86,6 +89,10 @@
@apply hx:my-2 hx:ps-6;
}
}
/* Horizontal line */
:where(hr):not(:where([class~=not-prose],[class~=not-prose] *)) {
@apply hx:my-10 hx:first:mt-0 hx:last:mb-0 hx:border-gray-200 hx:dark:border-neutral-800;
}
.footnotes {
@apply hx:mt-12 hx:text-sm;
@@ -93,28 +100,27 @@
@apply hx:border-gray-200 hx:dark:border-neutral-800;
}
}
}
.subheading-anchor {
@apply hx:opacity-0 hx:transition-opacity hx:ltr:ml-1 hx:rtl:mr-1;
span:target + &,
:hover > &,
&:focus {
@apply hx:opacity-100;
}
span + &,
:hover > & {
@apply hx:no-underline!;
}
@apply hx:after:text-gray-300 hx:dark:after:text-neutral-700;
&:after {
@apply hx:content-['#'] hx:px-1;
span:target + & {
@apply hx:text-gray-400;
@apply hx:dark:text-neutral-500;
.subheading-anchor {
@apply hx:opacity-0 hx:transition-opacity hx:ltr:ml-1 hx:rtl:mr-1;
span:target + &,
:hover > &,
&:focus {
@apply hx:opacity-100;
}
span + &,
:hover > & {
@apply hx:no-underline!;
}
@apply hx:after:text-gray-300 hx:dark:after:text-neutral-700;
&:after {
@apply hx:content-['#'] hx:px-1;
span:target + & {
@apply hx:text-gray-400;
@apply hx:dark:text-neutral-500;
}
}
}
}