From f3f6d006cf12a2e0ca7f5e108a897532fe7de7da Mon Sep 17 00:00:00 2001 From: ws-rush Date: Wed, 31 Dec 2025 13:52:50 +0300 Subject: [PATCH] refactor: Improve RTL support by adopting logical CSS properties. --- .../node/markdown/plugins/snippet.test.ts | 6 ++-- docs/.postcssrc.json | 8 ----- docs/components/ModalDemo.vue | 4 +-- docs/package.json | 1 - docs/ru/components/ModalDemo.vue | 4 +-- pnpm-lock.yaml | 32 ------------------- src/client/theme-default/Layout.vue | 13 ++++++-- .../theme-default/components/VPBadge.vue | 2 +- .../theme-default/components/VPContent.vue | 6 ++-- src/client/theme-default/components/VPDoc.vue | 6 ++-- .../components/VPDocAsideOutline.vue | 6 ++-- .../theme-default/components/VPDocFooter.vue | 6 ++-- .../components/VPDocOutlineItem.vue | 6 ++-- .../theme-default/components/VPFeature.vue | 4 +-- .../theme-default/components/VPFlyout.vue | 6 ++-- .../theme-default/components/VPHero.vue | 2 +- .../components/VPHomeContent.vue | 4 +-- .../theme-default/components/VPLocalNav.vue | 4 +-- .../components/VPLocalNavOutlineDropdown.vue | 17 ++++++---- .../components/VPLocalSearchBox.vue | 4 +-- .../theme-default/components/VPMenu.vue | 2 +- .../theme-default/components/VPMenuLink.vue | 2 +- src/client/theme-default/components/VPNav.vue | 3 +- .../theme-default/components/VPNavBar.vue | 30 ++++++++--------- .../components/VPNavBarExtra.vue | 4 +-- .../components/VPNavBarHamburger.vue | 12 +++---- .../components/VPNavBarSearch.vue | 4 +-- .../components/VPNavBarTitle.vue | 2 +- .../components/VPNavScreenMenuGroupLink.vue | 2 +- .../components/VPNavScreenTranslations.vue | 5 +-- .../theme-default/components/VPSidebar.vue | 13 +++++--- .../components/VPSidebarItem.vue | 15 +++++---- .../theme-default/components/VPSkipLink.vue | 4 +-- .../theme-default/components/VPSwitch.vue | 2 +- .../components/VPTeamMembersItem.vue | 6 ++-- .../components/VPTeamPageSection.vue | 2 +- .../components/icons/VPIconArrowLeft.vue | 2 +- .../components/icons/VPIconArrowRight.vue | 2 +- .../components/icons/VPIconChevronLeft.vue | 2 +- .../components/icons/VPIconChevronRight.vue | 2 +- src/client/theme-default/styles/base.css | 4 +++ .../styles/components/vp-code-group.css | 10 +++--- .../styles/components/vp-doc.css | 16 +++++----- 43 files changed, 132 insertions(+), 155 deletions(-) delete mode 100644 docs/.postcssrc.json diff --git a/__tests__/unit/node/markdown/plugins/snippet.test.ts b/__tests__/unit/node/markdown/plugins/snippet.test.ts index aa940784a..f0704fe80 100644 --- a/__tests__/unit/node/markdown/plugins/snippet.test.ts +++ b/__tests__/unit/node/markdown/plugins/snippet.test.ts @@ -208,16 +208,16 @@ describe('node/markdown/plugins/snippet', () => { const lines = [ '.body-content {', '/* #region foo */', - ' padding-left: 15px;', + ' padding-inline-start: 15px;', '/* #endregion foo */', - ' padding-right: 15px;', + ' padding-inline-end: 15px;', '}' ] const result = findRegion(lines, 'foo') expect(result).not.toBeNull() if (result) { expect(lines.slice(result.start, result.end).join('\n')).toBe( - ' padding-left: 15px;' + ' padding-inline-start: 15px;' ) } }) diff --git a/docs/.postcssrc.json b/docs/.postcssrc.json deleted file mode 100644 index edc6a490f..000000000 --- a/docs/.postcssrc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "plugins": { - "postcss-rtlcss": { - "ltrPrefix": ":where([dir=\"ltr\"])", - "rtlPrefix": ":where([dir=\"rtl\"])" - } - } -} diff --git a/docs/components/ModalDemo.vue b/docs/components/ModalDemo.vue index 93dbab8f6..7ab65d8e3 100644 --- a/docs/components/ModalDemo.vue +++ b/docs/components/ModalDemo.vue @@ -27,7 +27,7 @@ const showModal = ref(false) position: fixed; z-index: 200; top: 0; - left: 0; + inset-inline-start: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); @@ -49,7 +49,7 @@ const showModal = ref(false) .model-footer { margin-top: 8px; - text-align: right; + text-align: end; } .modal-button { diff --git a/docs/package.json b/docs/package.json index 0ccd31070..207ad32c7 100644 --- a/docs/package.json +++ b/docs/package.json @@ -13,7 +13,6 @@ "@lunariajs/core": "^0.1.1", "markdown-it-mathjax3": "^4.3.2", "open-cli": "^8.0.0", - "postcss-rtlcss": "^5.7.1", "vitepress": "workspace:*", "vitepress-plugin-group-icons": "^1.6.5", "vitepress-plugin-llms": "^1.9.3" diff --git a/docs/ru/components/ModalDemo.vue b/docs/ru/components/ModalDemo.vue index 85c9dec12..14c00bc84 100644 --- a/docs/ru/components/ModalDemo.vue +++ b/docs/ru/components/ModalDemo.vue @@ -29,7 +29,7 @@ const showModal = ref(false) position: fixed; z-index: 200; top: 0; - left: 0; + inset-inline-start: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); @@ -51,7 +51,7 @@ const showModal = ref(false) .model-footer { margin-top: 8px; - text-align: right; + text-align: end; } .modal-button { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a82ff3ff9..6f5f87ad5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -333,9 +333,6 @@ importers: open-cli: specifier: ^8.0.0 version: 8.0.0 - postcss-rtlcss: - specifier: ^5.7.1 - version: 5.7.1(postcss@8.5.6) vitepress: specifier: workspace:* version: link:.. @@ -2545,12 +2542,6 @@ packages: resolution: {integrity: sha512-ryc8D/B5E/YnlWHkNMnRvNntPc4GwU1/+iDBjiXVz1SUjDRqlxYX5Ic0IaDLA/cQ+g7/x+jUzEjv2K16u1J+wA==} engines: {node: '>=8'} - postcss-rtlcss@5.7.1: - resolution: {integrity: sha512-zE68CuARv5StOG/UQLa0W1Y/raUTzgJlfjtas43yh3/G1BFmoPEaHxPRHgeowXRFFhW33FehrNgsljxRLmPVWw==} - engines: {node: '>=18.0.0'} - peerDependencies: - postcss: ^8.4.21 - postcss-selector-parser@7.1.0: resolution: {integrity: sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA==} engines: {node: '>=4'} @@ -2729,11 +2720,6 @@ packages: engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true - rtlcss@4.3.0: - resolution: {integrity: sha512-FI+pHEn7Wc4NqKXMXFM+VAYKEj/mRIcW4h24YVwVtyjI+EqGrLc2Hx/Ny0lrZ21cBWU2goLy36eqMcNj3AQJig==} - engines: {node: '>=12.0.0'} - hasBin: true - run-applescript@7.1.0: resolution: {integrity: sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==} engines: {node: '>=18'} @@ -2889,10 +2875,6 @@ packages: resolution: {integrity: sha512-aulFJcD6YK8V1G7iRB5tigAP4TsHBZZrOV8pjV++zdUwmeV8uzbY7yn6h9MswN62adStNZFuCIx4haBnRuMDaw==} engines: {node: '>=18'} - strip-json-comments@3.1.1: - resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} - engines: {node: '>=8'} - strip-literal@3.1.0: resolution: {integrity: sha512-8r3mkIM/2+PpjHoOtiAW8Rg3jJLHaV7xPwG+YRGrv6FP0wwk/toTpATxWYOW0BKdWwl82VT2tFYi5DlROa0Mxg==} @@ -5338,11 +5320,6 @@ snapshots: '@polka/url': 1.0.0-next.29 trouter: 4.0.0 - postcss-rtlcss@5.7.1(postcss@8.5.6): - dependencies: - postcss: 8.5.6 - rtlcss: 4.3.0 - postcss-selector-parser@7.1.0: dependencies: cssesc: 3.0.0 @@ -5547,13 +5524,6 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.53.2 fsevents: 2.3.3 - rtlcss@4.3.0: - dependencies: - escalade: 3.2.0 - picocolors: 1.1.1 - postcss: 8.5.6 - strip-json-comments: 3.1.1 - run-applescript@7.1.0: {} run-parallel@1.2.0: @@ -5710,8 +5680,6 @@ snapshots: strip-final-newline@4.0.0: {} - strip-json-comments@3.1.1: {} - strip-literal@3.1.0: dependencies: js-tokens: 9.0.1 diff --git a/src/client/theme-default/Layout.vue b/src/client/theme-default/Layout.vue index ace5edd53..49a41d77f 100644 --- a/src/client/theme-default/Layout.vue +++ b/src/client/theme-default/Layout.vue @@ -1,5 +1,5 @@