feat: 统一 css 命名规范

This commit is contained in:
XiaoDaiGua-Ray 2026-09-19 21:47:03 +08:00
parent 6d2b557d27
commit 0c2f9d40e0
25 changed files with 56 additions and 60 deletions

View File

@ -69,6 +69,7 @@
"codabar",
"commitmsg",
"crossorigin",
"daterange",
"datetimerange",
"depcheckrc",
"domtoimage",

View File

@ -93,7 +93,7 @@
}
}
.ray-template--light {
.r-template--light {
.app-lock-screen__unlock__content-bg__wrapper {
background-color: #fff !important;
}

View File

@ -10,8 +10,8 @@ import type { MessageProviderProps } from 'naive-ui'
* 避免样式出现奇奇怪怪的问题。
*/
export const GLOBAL_CLASS_NAMES = {
darkClassName: 'ray-template--dark',
lightClassName: 'ray-template--light',
darkClassName: 'r-template--dark',
lightClassName: 'r-template--light',
rayTemplateThemePrimaryColor: '--r-theme-primary-color',
rayTemplateThemePrimaryFadeColor: '--r-theme-primary-fade-color',
preLoadingAnimation: 'pre-loading-animation',
@ -72,9 +72,9 @@ export const PRE_LOADING_CONFIG: PreloadingConfig = {
* 默认不启用。
*
* @example
* export const APP_CATCH_KEY_PREFIX = 'ray-template:'
* export const APP_CATCH_KEY_PREFIX = 'r-template:'
*
* 转换后的缓存 key: ray-template:signing。
* 转换后的缓存 key: r-template:signing。
*/
export const APP_CATCH_KEY_PREFIX = ''

View File

@ -534,7 +534,7 @@ export default defineComponent({
return preset === 'card' ? (
<NCard
class="ray-chart"
class="r-chart"
ref="rayChartWrapperRef"
style={[this.cssVarsRef]}
contentStyle={contentStyle}
@ -543,7 +543,7 @@ export default defineComponent({
>
{{
default: renderNode(
<div class="ray-chart__container" ref="chartRef"></div>,
<div class="r-chart__container" ref="chartRef"></div>,
),
header: renderNode(title, {
defaultElement: <div style="display: none;"></div>,
@ -563,8 +563,8 @@ export default defineComponent({
}}
</NCard>
) : (
<div class="ray-chart" style={[this.cssVarsRef]} ref="rayChartWrapperRef">
<div class="ray-chart__container" ref="chartRef"></div>
<div class="r-chart" style={[this.cssVarsRef]} ref="rayChartWrapperRef">
<div class="r-chart__container" ref="chartRef"></div>
</div>
)
},

View File

@ -1,4 +1,4 @@
.ray-chart {
.r-chart {
width: var(--r-chart-width);
height: var(--r-chart-height);
border: none;
@ -6,7 +6,7 @@
box-sizing: border-box;
transition: width 0.35s var(--r-bezier);
& .ray-chart__container {
& .r-chart__container {
width: 100%;
height: 100%;
box-sizing: border-box;

View File

@ -1,4 +1,4 @@
.ray-collapse-grid {
.r-collapse-grid {
box-sizing: border-box;
& .collapse-icon {
@ -21,7 +21,7 @@
}
}
.ray-collapse-grid__suffix--btn {
.r-collapse-grid__suffix--btn {
align-self: var(--r-collapse-grid-action-align);
}
}

View File

@ -87,7 +87,7 @@ export default defineComponent({
{{
default: () => (
<NGrid
class="ray-collapse-grid"
class="r-collapse-grid"
{...($props as GridProps)}
collapsed={modelCollapsed}
xGap={xGap || 12}
@ -97,7 +97,7 @@ export default defineComponent({
{defaultSlot?.()}
<NGridItem
suffix
class="ray-collapse-grid__suffix--btn"
class="r-collapse-grid__suffix--btn"
span={actionSpan}
>
<NFlex justify="end" align="center">

View File

@ -56,16 +56,13 @@ export default defineComponent({
},
render() {
return (
<div
class={['ray-iframe', this.iframeWrapperClass]}
style={[this.cssVars]}
>
<div class={['r-iframe', this.iframeWrapperClass]} style={[this.cssVars]}>
<NSpin {...this.customSpinProps} show={this.spinShow}>
{{
...this.$slots,
default: () => (
<iframe
class={['ray-iframe__container', this.iframeClass]}
class={['r-iframe__container', this.iframeClass]}
ref="iframeRef"
src={this.src}
allow={this.allow}

View File

@ -1,10 +1,10 @@
.ray-iframe {
.r-iframe {
width: var(--r-iframe-width);
height: var(--r-iframe-height);
box-sizing: border-box;
border: var(--r-iframe-frameborder);
& .ray-iframe__container {
& .r-iframe__container {
width: 100%;
height: 100%;
border: 0;

View File

@ -5,7 +5,7 @@
* @description
* 该指令用于处理元素的禁用状态,使用的时候必须传递正确的 value 值。
*
* 该方法依赖 ray-template__directive--disabled 样式类,需要在全局样式中定义,
* 该方法依赖 r-template__directive--disabled 样式类,需要在全局样式中定义,
* 并且该指令仅仅是做了 css 样式层面的禁用效果,如果有需要,还需要在业务逻辑中做相应的处理。
*
* @example
@ -19,7 +19,7 @@ import { removeClass, setClass } from '@/utils'
const updateElementDisabledType = (el: HTMLElement, value: boolean) => {
if (el) {
const classes = 'ray-template__directive--disabled'
const classes = 'r-template__directive--disabled'
if (value) {
el.setAttribute('disabled', 'disabled')

View File

@ -1,4 +1,4 @@
.ray-menu__logo {
.r-menu__logo {
height: $layoutHeaderHeight;
padding: 0 18px 0 24px;
display: flex;
@ -9,7 +9,7 @@
font-weight: 600;
overflow: hidden;
&.ray-menu__logo-url {
&.r-menu__logo-url {
position: sticky;
top: 0;
cursor: pointer;
@ -17,13 +17,13 @@
z-index: 20;
}
& .ray-menu__logo-title {
& .r-menu__logo-title {
opacity: 0;
display: none;
flex: 1;
@include overflowEllipsis;
&.ray-menu__logo-title--open {
&.r-menu__logo-title--open {
opacity: 1;
display: inline-block;
}

View File

@ -64,10 +64,7 @@ export default defineComponent({
return sideBarLogo?.title ? (
<div
class={[
'ray-menu__logo',
sideBarLogo?.url ? 'ray-menu__logo-url' : null,
]}
class={['r-menu__logo', sideBarLogo?.url ? 'r-menu__logo-url' : null]}
onClick={sideBarLogoClick.bind(this)}
ref={SIDER_BAR_LOGO}
>
@ -101,8 +98,8 @@ export default defineComponent({
) : null}
<NGradientText
class={[
!collapsed ? 'ray-menu__logo-title--open' : null,
'ray-menu__logo-title',
!collapsed ? 'r-menu__logo-title--open' : null,
'r-menu__logo-title',
'class="n-menu-item-content"',
]}
type="primary"

View File

@ -6,10 +6,10 @@
}
}
.ray-template--light .app-menu__sider {
.r-template--light .app-menu__sider {
box-shadow: 2px 0 8px $layoutShadowColorLight;
}
.ray-template--dark .app-menu__sider {
.r-template--dark .app-menu__sider {
box-shadow: 2px 0 8px $layoutShadowColorDark;
}

View File

@ -47,8 +47,8 @@ $menuTagWrapperWidth: 76px;
}
}
.ray-template--light,
.ray-template--dark {
.r-template--light,
.r-template--dark {
.menu-tag__btn .menu-tag__btn-icon {
border-radius: 2px;
@ -70,11 +70,11 @@ $menuTagWrapperWidth: 76px;
animation: elementRotate 0.8s linear infinite;
}
.ray-template--light .menu-tag {
.r-template--light .menu-tag {
box-shadow: 0 2px 2px $layoutShadowColorLight;
}
.ray-template--dark .menu-tag {
.r-template--dark .menu-tag {
box-shadow: 0 2px 2px $layoutShadowColorDark;
}

View File

@ -9,11 +9,11 @@
}
}
.ray-template--light .layout-header {
.r-template--light .layout-header {
box-shadow: 0 1px 2px $layoutShadowColorLight;
}
.ray-template--dark .layout-header {
.r-template--dark .layout-header {
box-shadow: 0 1px 2px $layoutShadowColorDark;
}

View File

@ -82,7 +82,7 @@ export default defineComponent({
showSettings.value = true
},
github: () => {
window.open('https://github.com/XiaoDaiGua-Ray/ray-template')
window.open('https://github.com/XiaoDaiGua-Ray/r-template')
},
fullscreen: () => {
if (!isEnabled) {

View File

@ -25,7 +25,7 @@
}
}
.ray-template--light {
.r-template--light {
.layout-content__maximize-out {
background-color: #d5d3d1;
color: #44403c;
@ -37,7 +37,7 @@
}
}
.ray-template--dark {
.r-template--dark {
.layout-content__maximize-out {
background-color: #44403c;
color: #d5d3d1;
@ -49,10 +49,10 @@
}
}
.ray-template--dark .r-layout-full__viewer-content {
.r-template--dark .r-layout-full__viewer-content {
background-color: $layoutContentBackgroundColorDark;
}
.ray-template--light .r-layout-full__viewer-content {
.r-template--light .r-layout-full__viewer-content {
background-color: $layoutContentBackgroundColorLight;
}

View File

@ -4,10 +4,10 @@
line-height: 48px;
}
.ray-template--dark .layout-footer-wrapper {
.r-template--dark .layout-footer-wrapper {
background-color: $layoutFooterBackgroundColorDark;
}
.ray-template--light .layout-footer-wrapper {
.r-template--light .layout-footer-wrapper {
background-color: $layoutFooterBackgroundColorLight;
}

View File

@ -28,10 +28,10 @@
}
}
.ray-template--light .r-layout-full__viewer-content {
.r-template--light .r-layout-full__viewer-content {
box-shadow: 0 -1px 2px $layoutShadowColorLight;
}
.ray-template--dark .r-layout-full__viewer-content {
.r-template--dark .r-layout-full__viewer-content {
box-shadow: 0 -1px 2px $layoutShadowColorDark;
}

View File

@ -103,7 +103,7 @@ export interface AppRouteMeta {
* 页面缓存。
*
* 如果缓存会出现失败的情况,请查看该文档排查。
* @see https://xiaodaigua-ray.github.io/ray-template-doc/ray-template-docs/common-problem/keep-alive.html
* @see https://xiaodaigua-ray.github.io/r-template-doc/r-template-docs/common-problem/keep-alive.html
*/
keepAlive?: boolean
/**

View File

@ -93,7 +93,7 @@ body {
}
// 配合 v-disabled 指令使用
html .ray-template__directive--disabled {
html .r-template__directive--disabled {
opacity: 0.3 !important;
pointer-events: none !important;
cursor: not-allowed !important;

View File

@ -43,7 +43,7 @@
// 根据主题切换样式
@mixin useAppTheme($theme) {
html[class='ray-template--#{$theme}'] & {
html[class='r-template--#{$theme}'] & {
@content;
}
}

View File

@ -18,8 +18,8 @@ export interface PrefixCacheKeyOptions {
* 当你需要自定义前缀时,可以传入 customPrefix,当 customPrefix 存在时,会使用 customPrefix 作为前缀。
*
* @example
* // 假设 APP_CATCH_KEY_PREFIX = 'ray-template:'
* prefixCacheKey('signing') // 返回 'ray-template:signing'
* // 假设 APP_CATCH_KEY_PREFIX = 'r-template:'
* prefixCacheKey('signing') // 返回 'r-template:signing'
*
* // customPrefix 自定义前缀
* prefixCacheKey('signing', { customPrefix: 'ray' }) // 返回 'ray:signing'

View File

@ -1,4 +1,4 @@
.ray-template--light {
.r-template--light {
& .sso-signing {
color: #878787;
}

View File

@ -18,7 +18,8 @@ $positionY: 24px;
position: absolute;
width: var(--login-height);
height: 2px;
background: linear-gradient(
background:
linear-gradient(
135deg,
transparent,
transparent 75%,
@ -91,7 +92,7 @@ $positionY: 24px;
}
}
.ray-template--light {
.r-template--light {
& .login__left-wrapper {
background-color: rgba(32, 128, 240, 0.22);
}
@ -101,7 +102,7 @@ $positionY: 24px;
}
}
.ray-template--dark {
.r-template--dark {
& .login__left-wrapper {
background-color: #2c354b;
}