From 41f6b37e561bcad211b25db0722576d1072404a4 Mon Sep 17 00:00:00 2001 From: ZhenShuo Leo <98386542+ZhenShuo2021@users.noreply.github.com> Date: Sat, 2 Aug 2025 07:47:41 +0800 Subject: [PATCH] refactor(tailwind): use logical properties for language direction --- assets/css/compiled/main.css | 197 +++++------------- exampleSite/content/_index.it.md | 4 +- exampleSite/content/_index.ja.md | 2 +- exampleSite/content/_index.md | 2 +- exampleSite/content/_index.zh-cn.md | 2 +- layouts/_default/_markup/render-heading.html | 2 +- layouts/_default/baseof.html | 2 +- layouts/_default/list.html | 4 +- layouts/_default/single.html | 4 +- layouts/partials/article-link/_shortcode.html | 2 +- layouts/partials/article-link/simple.html | 2 +- layouts/partials/author-extra.html | 2 +- layouts/partials/author.html | 4 +- layouts/partials/footer.html | 2 +- layouts/partials/header/basic.html | 6 +- layouts/partials/series/series-closed.html | 2 +- layouts/partials/series/series.html | 2 +- layouts/partials/series/series_base.html | 6 +- layouts/partials/toc.html | 12 +- layouts/partials/translations.html | 2 +- layouts/shortcodes/alert.html | 4 +- layouts/shortcodes/codeberg.html | 2 +- layouts/shortcodes/forgejo.html | 2 +- layouts/shortcodes/gitea.html | 2 +- layouts/shortcodes/github.html | 2 +- layouts/shortcodes/gitlab.html | 2 +- 26 files changed, 90 insertions(+), 185 deletions(-) diff --git a/assets/css/compiled/main.css b/assets/css/compiled/main.css index e7a36ad8..0c5b0abd 100644 --- a/assets/css/compiled/main.css +++ b/assets/css/compiled/main.css @@ -491,6 +491,9 @@ body.zen-mode-enable { .inset-x-0 { inset-inline: calc(var(--spacing) * 0); } + .-start-6 { + inset-inline-start: calc(var(--spacing) * -6); + } .top-0 { top: calc(var(--spacing) * 0); } @@ -623,9 +626,24 @@ body.zen-mode-enable { .my-3 { margin-block: calc(var(--spacing) * 3); } + .-ms-5 { + margin-inline-start: calc(var(--spacing) * -5); + } + .ms-0 { + margin-inline-start: calc(var(--spacing) * 0); + } + .ms-2 { + margin-inline-start: calc(var(--spacing) * 2); + } + .me-1 { + margin-inline-end: calc(var(--spacing) * 1); + } .me-2 { margin-inline-end: calc(var(--spacing) * 2); } + .me-4 { + margin-inline-end: calc(var(--spacing) * 4); + } .prose { color: var(--tw-prose-body); max-width: 65ch; @@ -1144,9 +1162,6 @@ body.zen-mode-enable { .mr-5 { margin-right: calc(var(--spacing) * 5); } - .mr-\[10px\] { - margin-right: 10px; - } .mr-auto { margin-right: auto; } @@ -1760,6 +1775,10 @@ body.zen-mode-enable { border-inline-start-style: var(--tw-border-style); border-inline-start-width: 0px; } + .border-s-1 { + border-inline-start-style: var(--tw-border-style); + border-inline-start-width: 1px; + } .border-s-\[0\.125rem\] { border-inline-start-style: var(--tw-border-style); border-inline-start-width: 0.125rem; @@ -2034,6 +2053,15 @@ body.zen-mode-enable { .py-\[1px\] { padding-block: 1px; } + .ps-5 { + padding-inline-start: calc(var(--spacing) * 5); + } + .pe-2 { + padding-inline-end: calc(var(--spacing) * 2); + } + .pe-3 { + padding-inline-end: calc(var(--spacing) * 3); + } .pt-1 { padding-top: calc(var(--spacing) * 1); } @@ -2103,6 +2131,9 @@ body.zen-mode-enable { .text-center { text-align: center; } + .text-end { + text-align: end; + } .text-left { text-align: left; } @@ -2872,6 +2903,11 @@ body.zen-mode-enable { transition-property: none; } } + .sm\:me-7 { + @media (width >= 640px) { + margin-inline-end: calc(var(--spacing) * 7); + } + } .sm\:mt-16 { @media (width >= 640px) { margin-top: calc(var(--spacing) * 16); @@ -2928,6 +2964,13 @@ body.zen-mode-enable { line-height: var(--tw-leading, var(--text-lg--line-height)); } } + .sm\:last\:me-0 { + @media (width >= 640px) { + &:last-child { + margin-inline-end: calc(var(--spacing) * 0); + } + } + } .md\:mt-0 { @media (width >= 853px) { margin-top: calc(var(--spacing) * 0); @@ -3163,6 +3206,11 @@ body.zen-mode-enable { padding-block: calc(var(--spacing) * 32); } } + .lg\:ps-8 { + @media (width >= 1024px) { + padding-inline-start: calc(var(--spacing) * 8); + } + } .xl\:w-1\/4 { @media (width >= 1280px) { width: calc(1/4 * 100%); @@ -3183,36 +3231,11 @@ body.zen-mode-enable { right: calc(var(--spacing) * 0); } } - .ltr\:-left-6 { - &:where(:dir(ltr), [dir="ltr"], [dir="ltr"] *) { - left: calc(var(--spacing) * -6); - } - } - .ltr\:mr-1 { - &:where(:dir(ltr), [dir="ltr"], [dir="ltr"] *) { - margin-right: calc(var(--spacing) * 1); - } - } .ltr\:mr-4 { &:where(:dir(ltr), [dir="ltr"], [dir="ltr"] *) { margin-right: calc(var(--spacing) * 4); } } - .ltr\:-ml-5 { - &:where(:dir(ltr), [dir="ltr"], [dir="ltr"] *) { - margin-left: calc(var(--spacing) * -5); - } - } - .ltr\:ml-0 { - &:where(:dir(ltr), [dir="ltr"], [dir="ltr"] *) { - margin-left: calc(var(--spacing) * 0); - } - } - .ltr\:ml-2 { - &:where(:dir(ltr), [dir="ltr"], [dir="ltr"] *) { - margin-left: calc(var(--spacing) * 2); - } - } .ltr\:block { &:where(:dir(ltr), [dir="ltr"], [dir="ltr"] *) { display: block; @@ -3228,85 +3251,16 @@ body.zen-mode-enable { display: inline; } } - .ltr\:border-l { - &:where(:dir(ltr), [dir="ltr"], [dir="ltr"] *) { - border-left-style: var(--tw-border-style); - border-left-width: 1px; - } - } - .ltr\:pr-2 { - &:where(:dir(ltr), [dir="ltr"], [dir="ltr"] *) { - padding-right: calc(var(--spacing) * 2); - } - } - .ltr\:pr-3 { - &:where(:dir(ltr), [dir="ltr"], [dir="ltr"] *) { - padding-right: calc(var(--spacing) * 3); - } - } - .ltr\:pl-5 { - &:where(:dir(ltr), [dir="ltr"], [dir="ltr"] *) { - padding-left: calc(var(--spacing) * 5); - } - } .ltr\:text-right { &:where(:dir(ltr), [dir="ltr"], [dir="ltr"] *) { text-align: right; } } - .ltr\:sm\:mr-7 { - &:where(:dir(ltr), [dir="ltr"], [dir="ltr"] *) { - @media (width >= 640px) { - margin-right: calc(var(--spacing) * 7); - } - } - } - .ltr\:sm\:last\:mr-0 { - &:where(:dir(ltr), [dir="ltr"], [dir="ltr"] *) { - @media (width >= 640px) { - &:last-child { - margin-right: calc(var(--spacing) * 0); - } - } - } - } - .ltr\:lg\:pl-8 { - &:where(:dir(ltr), [dir="ltr"], [dir="ltr"] *) { - @media (width >= 1024px) { - padding-left: calc(var(--spacing) * 8); - } - } - } - .rtl\:-right-6 { - &:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) { - right: calc(var(--spacing) * -6); - } - } .rtl\:left-0 { &:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) { left: calc(var(--spacing) * 0); } } - .rtl\:-mr-5 { - &:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) { - margin-right: calc(var(--spacing) * -5); - } - } - .rtl\:mr-0 { - &:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) { - margin-right: calc(var(--spacing) * 0); - } - } - .rtl\:mr-2 { - &:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) { - margin-right: calc(var(--spacing) * 2); - } - } - .rtl\:ml-1 { - &:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) { - margin-left: calc(var(--spacing) * 1); - } - } .rtl\:ml-4 { &:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) { margin-left: calc(var(--spacing) * 4); @@ -3327,55 +3281,6 @@ body.zen-mode-enable { display: inline; } } - .rtl\:border-r { - &:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) { - border-right-style: var(--tw-border-style); - border-right-width: 1px; - } - } - .rtl\:pr-5 { - &:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) { - padding-right: calc(var(--spacing) * 5); - } - } - .rtl\:pl-2 { - &:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) { - padding-left: calc(var(--spacing) * 2); - } - } - .rtl\:pl-3 { - &:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) { - padding-left: calc(var(--spacing) * 3); - } - } - .rtl\:text-left { - &:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) { - text-align: left; - } - } - .rtl\:sm\:ml-7 { - &:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) { - @media (width >= 640px) { - margin-left: calc(var(--spacing) * 7); - } - } - } - .rtl\:sm\:last\:ml-0 { - &:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) { - @media (width >= 640px) { - &:last-child { - margin-left: calc(var(--spacing) * 0); - } - } - } - } - .rtl\:lg\:pr-8 { - &:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) { - @media (width >= 1024px) { - padding-right: calc(var(--spacing) * 8); - } - } - } .dark\:flex { &:is(.dark *) { display: flex; diff --git a/exampleSite/content/_index.it.md b/exampleSite/content/_index.it.md index 59db3d81..e1298209 100755 --- a/exampleSite/content/_index.it.md +++ b/exampleSite/content/_index.it.md @@ -3,7 +3,7 @@ title: "Benvenuti a Blowfish!" description: "Questa pagina è stata creata utilizzando il tema Blowfish per Hugo." ---
- + {{< icon "triangle-exclamation" >}} @@ -22,4 +22,4 @@ description: "Questa pagina è stata creata utilizzando il tema Blowfish per Hug npx blowfish-tools ``` -{{< youtubeLite id="SgXhGb-7QbU" label="Demo degli strumenti Blowfish" >}} \ No newline at end of file +{{< youtubeLite id="SgXhGb-7QbU" label="Demo degli strumenti Blowfish" >}} diff --git a/exampleSite/content/_index.ja.md b/exampleSite/content/_index.ja.md index c55cba9f..aa23d110 100755 --- a/exampleSite/content/_index.ja.md +++ b/exampleSite/content/_index.ja.md @@ -5,7 +5,7 @@ description: "このページは Hugo の Blowfish テーマを利用して構
- + {{< icon "triangle-exclamation" >}} diff --git a/exampleSite/content/_index.md b/exampleSite/content/_index.md index ab606415..e318e770 100755 --- a/exampleSite/content/_index.md +++ b/exampleSite/content/_index.md @@ -5,7 +5,7 @@ description: "This page was built using the Blowfish theme for Hugo."
- + {{< icon "triangle-exclamation" >}} diff --git a/exampleSite/content/_index.zh-cn.md b/exampleSite/content/_index.zh-cn.md index ac289b26..868e0bc3 100644 --- a/exampleSite/content/_index.zh-cn.md +++ b/exampleSite/content/_index.zh-cn.md @@ -5,7 +5,7 @@ description: "此页面是使用 Hugo 的 Blowfish 主题搭建的"
- + {{< icon "triangle-exclamation" >}} diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html index af251173..bb536f08 100644 --- a/layouts/_default/_markup/render-heading.html +++ b/layouts/_default/_markup/render-heading.html @@ -3,7 +3,7 @@
{{ if .Page.Params.showHeadingAnchors | default (.Page.Site.Params.article.showHeadingAnchors | default true) }} + class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"> # {{ end }} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index b746f93e..126af5c4 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -18,7 +18,7 @@ - + {{ i18n "nav.skip_to_main" }}
diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 10d78f1a..0d0ba8c5 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -45,8 +45,8 @@ {{ $topClass := cond (hasPrefix site.Params.header.layout "fixed") "lg:top-[140px]" "lg:top-10" }}
{{ if $showToc }} -
-
+
+
{{ partial "toc.html" . }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 6d1f9c1f..7a879316 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -36,8 +36,8 @@ {{ $showRelated := site.Params.article.showRelatedPosts | default false }} {{ $topClass := cond (hasPrefix site.Params.header.layout "fixed") "lg:top-[140px]" "lg:top-10" }} {{ if or $showToc $showRelated }} -
-
+
+
{{ if $showToc }} {{ partial "toc.html" . }} {{ end }} diff --git a/layouts/partials/article-link/_shortcode.html b/layouts/partials/article-link/_shortcode.html index 46ab8ec2..c9eee3e9 100644 --- a/layouts/partials/article-link/_shortcode.html +++ b/layouts/partials/article-link/_shortcode.html @@ -91,7 +91,7 @@
{{ end }} {{ if and $target.Draft site.Params.article.showDraftLabel }} -
+
{{ partial "badge.html" (i18n "article.draft" | emojify) }}
{{ end }} diff --git a/layouts/partials/article-link/simple.html b/layouts/partials/article-link/simple.html index 44b5ac2e..8e88b9d3 100644 --- a/layouts/partials/article-link/simple.html +++ b/layouts/partials/article-link/simple.html @@ -85,7 +85,7 @@
{{ end }} {{ if and .Draft .Site.Params.article.showDraftLabel }} -
{{ partial "badge.html" (i18n "article.draft" | emojify) }}
+
{{ partial "badge.html" (i18n "article.draft" | emojify) }}
{{ end }} {{ if templates.Exists "partials/extend-article-link.html" }} {{ partial "extend-article-link.html" . }} diff --git a/layouts/partials/author-extra.html b/layouts/partials/author-extra.html index 78a93ee0..0ea83878 100644 --- a/layouts/partials/author-extra.html +++ b/layouts/partials/author-extra.html @@ -12,7 +12,7 @@ {{ $authorImage = $authorImage.Fill "192x192" }} {{ end }} diff --git a/layouts/partials/author.html b/layouts/partials/author.html index 4c4d987d..50d2f54c 100644 --- a/layouts/partials/author.html +++ b/layouts/partials/author.html @@ -12,7 +12,7 @@ {{ $authorImage = $authorImage.Fill "192x192" }} {{ end }} {{ $.Site.Params.Author.name | default