From 2fe0fc95eece791c42d5b0007b21f26f57cbce75 Mon Sep 17 00:00:00 2001
From: Hooray Hu <304327508@qq.com>
Date: Mon, 26 Aug 2024 23:16:32 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BC=95=E5=85=A5=20postcss-nested?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package.json | 1 +
plop-templates/component/index.hbs | 4 +-
plop-templates/page/index.hbs | 4 +-
pnpm-lock.yaml | 14 +++++
postcss.config.js | 3 +-
.../styles/{globals.scss => globals.css} | 35 ++++++-----
.../styles/{nprogress.scss => nprogress.css} | 0
src/components/FileUpload/index.vue | 2 +-
src/components/FixedActionBar/index.vue | 2 +-
src/components/ImagePreview/index.vue | 2 +-
src/components/ImageUpload/index.vue | 14 +++--
src/components/ImagesUpload/index.vue | 14 +++--
src/components/LoginForm/index.vue | 2 +-
src/components/RegisterForm/index.vue | 2 +-
src/components/ResetPasswordForm/index.vue | 2 +-
src/layouts/components/AppSetting/index.vue | 44 +++++++-------
src/layouts/components/Breadcrumb/index.vue | 2 +-
src/layouts/components/Copyright/index.vue | 8 +--
src/layouts/components/Header/index.vue | 8 +--
src/layouts/components/MainSidebar/index.vue | 8 +--
src/layouts/components/SubSidebar/index.vue | 8 +--
.../components/Topbar/Tabbar/index.vue | 60 +++++++++----------
.../Topbar/Toolbar/Breadcrumb/index.vue | 4 +-
.../components/Topbar/Toolbar/index.vue | 2 +-
src/layouts/components/Topbar/index.vue | 2 +-
src/layouts/components/views/link.vue | 2 +-
src/layouts/index.vue | 6 +-
src/main.ts | 2 +-
src/router/index.ts | 2 +-
src/views/index.vue | 14 ++---
src/views/login.vue | 7 ++-
31 files changed, 152 insertions(+), 128 deletions(-)
rename src/assets/styles/{globals.scss => globals.css} (79%)
rename src/assets/styles/{nprogress.scss => nprogress.css} (100%)
diff --git a/package.json b/package.json
index 4b9320ef2..79913aee3 100755
--- a/package.json
+++ b/package.json
@@ -81,6 +81,7 @@
"picocolors": "^1.0.1",
"plop": "^4.0.1",
"postcss": "^8.4.40",
+ "postcss-nested": "^6.2.0",
"sass": "^1.77.8",
"simple-git-hooks": "^2.11.1",
"stylelint": "^16.8.1",
diff --git a/plop-templates/component/index.hbs b/plop-templates/component/index.hbs
index 69f759518..1d62a0259 100755
--- a/plop-templates/component/index.hbs
+++ b/plop-templates/component/index.hbs
@@ -12,6 +12,6 @@ defineOptions({
-
diff --git a/plop-templates/page/index.hbs b/plop-templates/page/index.hbs
index 09f0dbd8c..4d5dc48cb 100755
--- a/plop-templates/page/index.hbs
+++ b/plop-templates/page/index.hbs
@@ -17,6 +17,6 @@ defineOptions({
-
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index f6a05bf5b..dd3fc1c9f 100755
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -177,6 +177,9 @@ importers:
postcss:
specifier: ^8.4.40
version: 8.4.40
+ postcss-nested:
+ specifier: ^6.2.0
+ version: 6.2.0(postcss@8.4.40)
sass:
specifier: ^1.77.8
version: 1.77.8
@@ -4949,6 +4952,12 @@ packages:
postcss-media-query-parser@0.2.3:
resolution: {integrity: sha512-3sOlxmbKcSHMjlUXQZKQ06jOswE7oVkXPxmZdoB1r5l0q6gTFTQSHxNxOrCccElbW7dxNytifNEo8qidX2Vsig==}
+ postcss-nested@6.2.0:
+ resolution: {integrity: sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ==}
+ engines: {node: '>=12.0'}
+ peerDependencies:
+ postcss: ^8.2.14
+
postcss-prefix-selector@1.16.0:
resolution: {integrity: sha512-rdVMIi7Q4B0XbXqNUEI+Z4E+pueiu/CS5E6vRCQommzdQ/sgsS4dK42U7GX8oJR+TJOtT+Qv3GkNo6iijUMp3Q==}
peerDependencies:
@@ -11467,6 +11476,11 @@ snapshots:
postcss-media-query-parser@0.2.3: {}
+ postcss-nested@6.2.0(postcss@8.4.40):
+ dependencies:
+ postcss: 8.4.40
+ postcss-selector-parser: 6.1.1
+
postcss-prefix-selector@1.16.0(postcss@5.2.18):
dependencies:
postcss: 5.2.18
diff --git a/postcss.config.js b/postcss.config.js
index b6dc0349e..f20659c17 100755
--- a/postcss.config.js
+++ b/postcss.config.js
@@ -1,5 +1,6 @@
export default {
plugins: {
- autoprefixer: {},
+ 'autoprefixer': {},
+ 'postcss-nested': {},
},
}
diff --git a/src/assets/styles/globals.scss b/src/assets/styles/globals.css
similarity index 79%
rename from src/assets/styles/globals.scss
rename to src/assets/styles/globals.css
index 699c96a7d..add36b2eb 100755
--- a/src/assets/styles/globals.scss
+++ b/src/assets/styles/globals.css
@@ -1,20 +1,24 @@
-// 页面布局 CSS 变量
+/* 页面布局 CSS 变量 */
:root {
- // 头部高度
+ /* 头部高度 */
--g-header-height: 60px;
- // 侧边栏宽度
+
+ /* 侧边栏宽度 */
--g-main-sidebar-width: 80px;
--g-sub-sidebar-width: 220px;
--g-sub-sidebar-collapse-width: 64px;
- // 侧边栏 Logo 区域高度
+
+ /* 侧边栏 Logo 区域高度 */
--g-sidebar-logo-height: 50px;
- // 标签栏高度
+
+ /* 标签栏高度 */
--g-tabbar-height: 50px;
- // 工具栏高度
+
+ /* 工具栏高度 */
--g-toolbar-height: 50px;
}
-// 明暗模式 CSS 变量
+/* 明暗模式 CSS 变量 */
/* stylelint-disable-next-line no-duplicate-selectors */
:root {
--g-box-shadow-color: rgb(0 0 0 / 12%);
@@ -87,22 +91,21 @@ body {
box-sizing: inherit;
}
-// 右侧内容区针对fixed元素,有横向铺满的需求,可在fixed元素上设置 [data-fixed-calc-width]
+/* 右侧内容区针对fixed元素,有横向铺满的需求,可在fixed元素上设置 [data-fixed-calc-width] */
[data-fixed-calc-width] {
position: fixed;
right: 0;
left: 50%;
width: calc(100% - var(--g-main-sidebar-actual-width) - var(--g-sub-sidebar-actual-width));
transform: translateX(-50%) translateX(calc(var(--g-main-sidebar-actual-width) / 2)) translateX(calc(var(--g-sub-sidebar-actual-width) / 2));
-}
-[data-mode="mobile"] {
- [data-fixed-calc-width] {
+ [data-mode="mobile"] & {
width: 100% !important;
transform: translateX(-50%) !important;
}
}
-// textarea 字体跟随系统
+
+/* textarea 字体跟随系统 */
textarea {
font-family: inherit;
}
@@ -110,12 +113,12 @@ textarea {
/* Overrides Floating Vue */
.v-popper--theme-dropdown,
.v-popper--theme-tooltip {
- --at-apply: inline-flex;
+ --uno: inline-flex;
}
.v-popper--theme-dropdown .v-popper__inner,
.v-popper--theme-tooltip .v-popper__inner {
- --at-apply: bg-white dark-bg-stone-8 text-dark dark-text-white rounded shadow ring-1 ring-gray-200 dark-ring-gray-800 border border-solid border-stone/20 text-xs font-normal;
+ --uno: bg-white dark-bg-stone-8 text-dark dark-text-white rounded shadow ring-1 ring-gray-200 dark-ring-gray-800 border border-solid border-stone/20 text-xs font-normal;
box-shadow: 0 6px 30px rgb(0 0 0 / 10%);
}
@@ -124,12 +127,12 @@ textarea {
.v-popper--theme-dropdown .v-popper__arrow-inner {
visibility: visible;
- --at-apply: border-white dark-border-stone-8;
+ --uno: border-white dark-border-stone-8;
}
.v-popper--theme-tooltip .v-popper__arrow-outer,
.v-popper--theme-dropdown .v-popper__arrow-outer {
- --at-apply: border-stone/20;
+ --uno: border-stone/20;
}
.v-popper--theme-tooltip.v-popper--shown,
diff --git a/src/assets/styles/nprogress.scss b/src/assets/styles/nprogress.css
similarity index 100%
rename from src/assets/styles/nprogress.scss
rename to src/assets/styles/nprogress.css
diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue
index 19b8e0156..0af893da9 100755
--- a/src/components/FileUpload/index.vue
+++ b/src/components/FileUpload/index.vue
@@ -114,7 +114,7 @@ const onPreview: UploadProps['onPreview'] = (e) => {
-
diff --git a/src/layouts/components/Header/index.vue b/src/layouts/components/Header/index.vue
index 6a6a02d2c..ecf45d030 100755
--- a/src/layouts/components/Header/index.vue
+++ b/src/layouts/components/Header/index.vue
@@ -61,7 +61,7 @@ function handlerMouserScroll(event: WheelEvent) {
-
-