qm-law-ui 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +204 -0
- package/dist/components/law-button/index.vue.d.ts +26 -0
- package/dist/components/law-button/types.d.ts +14 -0
- package/dist/components/law-dialog/index.vue.d.ts +40 -0
- package/dist/components/law-dialog/types.d.ts +13 -0
- package/dist/hooks/use-law-theme.d.ts +9 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +291 -0
- package/dist/index.umd.cjs +1 -0
- package/dist/style.css +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/package.json +57 -0
- package/src/components/law-button/index.vue +106 -0
- package/src/components/law-button/types.ts +22 -0
- package/src/components/law-dialog/index.vue +100 -0
- package/src/components/law-dialog/types.ts +12 -0
- package/src/env.d.ts +12 -0
- package/src/hooks/use-law-theme.ts +66 -0
- package/src/index.ts +35 -0
- package/src/styles/theme.css +84 -0
- package/src/styles/variables.css +192 -0
- package/src/utils/index.ts +32 -0
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "qm-law-ui",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Law0S Design System components built on Vue 3 and Element Plus",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.umd.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.umd.cjs",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
},
|
|
15
|
+
"./theme.css": "./dist/theme.css",
|
|
16
|
+
"./style.css": "./dist/style.css"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"src"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"dev": "vite --config examples/vite.config.ts",
|
|
24
|
+
"preview": "vite preview --config examples/vite.config.ts",
|
|
25
|
+
"build": "vue-tsc --noEmit && vite build",
|
|
26
|
+
"prepublishOnly": "pnpm run build"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"vue",
|
|
30
|
+
"vue3",
|
|
31
|
+
"element-plus",
|
|
32
|
+
"component-library",
|
|
33
|
+
"qm-law-ui"
|
|
34
|
+
],
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"packageManager": "pnpm@10.30.3",
|
|
37
|
+
"pnpm": {
|
|
38
|
+
"overrides": {
|
|
39
|
+
"vite": "^5.4.11"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"vue": "^3.3.0",
|
|
44
|
+
"element-plus": ">=2.10.0 <2.14.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/node": "^22.10.0",
|
|
48
|
+
"@vitejs/plugin-vue": "5.2.4",
|
|
49
|
+
"element-plus": "2.13.1",
|
|
50
|
+
"terser": "^5.36.0",
|
|
51
|
+
"typescript": "~5.6.3",
|
|
52
|
+
"vite": "5.4.21",
|
|
53
|
+
"vite-plugin-dts": "4.5.4",
|
|
54
|
+
"vue": "^3.5.13",
|
|
55
|
+
"vue-tsc": "^2.1.10"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-button
|
|
3
|
+
v-bind="mergedProps"
|
|
4
|
+
:style="computedStyle"
|
|
5
|
+
class="law-button"
|
|
6
|
+
@click="onClick"
|
|
7
|
+
>
|
|
8
|
+
<slot />
|
|
9
|
+
<template v-if="$slots.loading" #loading>
|
|
10
|
+
<slot name="loading" />
|
|
11
|
+
</template>
|
|
12
|
+
<template v-if="$slots.icon" #icon>
|
|
13
|
+
<slot name="icon" />
|
|
14
|
+
</template>
|
|
15
|
+
</el-button>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup lang="ts">
|
|
19
|
+
import { ElButton } from 'element-plus'
|
|
20
|
+
import { computed, useAttrs } from 'vue'
|
|
21
|
+
import type { LawButtonProps, LawButtonSize } from './types'
|
|
22
|
+
|
|
23
|
+
defineOptions({
|
|
24
|
+
name: 'LawButton',
|
|
25
|
+
inheritAttrs: false,
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const props = withDefaults(defineProps<LawButtonProps>(), {
|
|
29
|
+
lawSize: 'md',
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const emit = defineEmits<{
|
|
33
|
+
click: [evt: MouseEvent]
|
|
34
|
+
}>()
|
|
35
|
+
|
|
36
|
+
const attrs = useAttrs()
|
|
37
|
+
|
|
38
|
+
const elSizeMap: Record<LawButtonSize, 'large' | 'default' | 'small'> = {
|
|
39
|
+
lg: 'large',
|
|
40
|
+
md: 'default',
|
|
41
|
+
sm: 'small',
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const mergedProps = computed(() => {
|
|
45
|
+
const { lawSize, size, ...rest } = props
|
|
46
|
+
return {
|
|
47
|
+
...attrs,
|
|
48
|
+
...rest,
|
|
49
|
+
size: size ?? elSizeMap[lawSize],
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
const computedStyle = computed(() => {
|
|
54
|
+
const heightMap: Record<LawButtonSize, string> = {
|
|
55
|
+
lg: 'var(--law-btn-size-lg)',
|
|
56
|
+
md: 'var(--law-btn-size-md)',
|
|
57
|
+
sm: 'var(--law-btn-size-sm)',
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
minHeight: heightMap[props.lawSize],
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
function onClick(evt: MouseEvent) {
|
|
65
|
+
emit('click', evt)
|
|
66
|
+
}
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<style scoped>
|
|
70
|
+
.law-button {
|
|
71
|
+
font-family: var(--law-font-family-zh);
|
|
72
|
+
border-radius: var(--law-radius-sm);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.law-button.el-button--default:not(.is-disabled):hover {
|
|
76
|
+
background-color: var(--law-btn-default-hover-bg);
|
|
77
|
+
color: var(--law-btn-default-hover-color);
|
|
78
|
+
border-color: var(--law-primary);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.law-button.el-button--primary:not(.is-disabled):hover {
|
|
82
|
+
background-color: var(--law-btn-primary-hover-bg);
|
|
83
|
+
color: var(--law-btn-primary-hover-color);
|
|
84
|
+
border-color: var(--law-btn-primary-hover-bg);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.law-button.el-button--success:not(.is-disabled):hover {
|
|
88
|
+
background-color: var(--law-btn-success-hover-bg);
|
|
89
|
+
color: var(--law-btn-success-hover-color);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.law-button.el-button--warning:not(.is-disabled):hover {
|
|
93
|
+
background-color: var(--law-btn-warning-hover-bg);
|
|
94
|
+
color: var(--law-btn-warning-hover-color);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.law-button.el-button--danger:not(.is-disabled):hover {
|
|
98
|
+
background-color: var(--law-btn-danger-hover-bg);
|
|
99
|
+
color: var(--law-btn-danger-hover-color);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.law-button.el-button--info:not(.is-disabled):hover {
|
|
103
|
+
background-color: var(--law-btn-info-hover-bg);
|
|
104
|
+
color: var(--law-btn-info-hover-color);
|
|
105
|
+
}
|
|
106
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ButtonEmits,
|
|
3
|
+
ButtonProps,
|
|
4
|
+
} from "element-plus/es/components/button";
|
|
5
|
+
|
|
6
|
+
/** Law 按钮尺寸(对齐 Law0S 设计规范) */
|
|
7
|
+
export type LawButtonSize = "lg" | "md" | "sm";
|
|
8
|
+
|
|
9
|
+
export interface LawButtonOwnProps {
|
|
10
|
+
/** Law 设计规范尺寸,映射至 Element Plus size */
|
|
11
|
+
lawSize?: LawButtonSize;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type LawButtonProps = LawButtonOwnProps & Partial<ButtonProps>;
|
|
15
|
+
|
|
16
|
+
export type LawButtonEmits = ButtonEmits;
|
|
17
|
+
|
|
18
|
+
export type LawButtonSlots = {
|
|
19
|
+
default?: () => unknown;
|
|
20
|
+
loading?: () => unknown;
|
|
21
|
+
icon?: () => unknown;
|
|
22
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog
|
|
3
|
+
v-bind="mergedProps"
|
|
4
|
+
class="law-dialog"
|
|
5
|
+
@open="onOpen"
|
|
6
|
+
@opened="onOpened"
|
|
7
|
+
@close="onClose"
|
|
8
|
+
@closed="onClosed"
|
|
9
|
+
@update:model-value="onUpdateModelValue"
|
|
10
|
+
@open-auto-focus="onOpenAutoFocus"
|
|
11
|
+
@close-auto-focus="onCloseAutoFocus"
|
|
12
|
+
>
|
|
13
|
+
<slot />
|
|
14
|
+
<template v-if="$slots.header" #header="headerProps">
|
|
15
|
+
<slot name="header" v-bind="headerProps" />
|
|
16
|
+
</template>
|
|
17
|
+
<template v-if="$slots.title" #title>
|
|
18
|
+
<slot name="title" />
|
|
19
|
+
</template>
|
|
20
|
+
<template v-if="$slots.footer" #footer>
|
|
21
|
+
<slot name="footer" />
|
|
22
|
+
</template>
|
|
23
|
+
</el-dialog>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script setup lang="ts">
|
|
27
|
+
import { ElDialog } from 'element-plus'
|
|
28
|
+
import { computed, useAttrs } from 'vue'
|
|
29
|
+
import type { LawDialogProps } from './types'
|
|
30
|
+
|
|
31
|
+
defineOptions({
|
|
32
|
+
name: 'LawDialog',
|
|
33
|
+
inheritAttrs: false,
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const props = defineProps<LawDialogProps>()
|
|
37
|
+
|
|
38
|
+
const emit = defineEmits<{
|
|
39
|
+
open: []
|
|
40
|
+
opened: []
|
|
41
|
+
close: []
|
|
42
|
+
closed: []
|
|
43
|
+
'update:modelValue': [value: boolean]
|
|
44
|
+
openAutoFocus: []
|
|
45
|
+
closeAutoFocus: []
|
|
46
|
+
}>()
|
|
47
|
+
|
|
48
|
+
const attrs = useAttrs()
|
|
49
|
+
|
|
50
|
+
const mergedProps = computed(() => ({
|
|
51
|
+
...attrs,
|
|
52
|
+
...props,
|
|
53
|
+
}))
|
|
54
|
+
|
|
55
|
+
function onOpen() {
|
|
56
|
+
emit('open')
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function onOpened() {
|
|
60
|
+
emit('opened')
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function onClose() {
|
|
64
|
+
emit('close')
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function onClosed() {
|
|
68
|
+
emit('closed')
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function onUpdateModelValue(value: boolean) {
|
|
72
|
+
emit('update:modelValue', value)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function onOpenAutoFocus() {
|
|
76
|
+
emit('openAutoFocus')
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function onCloseAutoFocus() {
|
|
80
|
+
emit('closeAutoFocus')
|
|
81
|
+
}
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<style scoped>
|
|
85
|
+
.law-dialog {
|
|
86
|
+
--el-dialog-border-radius: var(--law-radius-md);
|
|
87
|
+
font-family: var(--law-font-family-zh);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.law-dialog :deep(.el-dialog__header) {
|
|
91
|
+
color: var(--law-text-primary);
|
|
92
|
+
font-weight: var(--law-font-weight-semibold);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.law-dialog :deep(.el-dialog__body) {
|
|
96
|
+
color: var(--law-text-regular);
|
|
97
|
+
font-size: var(--law-font-size-body);
|
|
98
|
+
line-height: var(--law-line-height-body);
|
|
99
|
+
}
|
|
100
|
+
</style>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DialogEmits, DialogProps } from 'element-plus/es/components/dialog'
|
|
2
|
+
|
|
3
|
+
export type LawDialogProps = Partial<DialogProps>
|
|
4
|
+
|
|
5
|
+
export type LawDialogEmits = DialogEmits
|
|
6
|
+
|
|
7
|
+
export type LawDialogSlots = {
|
|
8
|
+
default?: () => unknown
|
|
9
|
+
header?: (props: { close: () => void; titleId: string; titleClass: string }) => unknown
|
|
10
|
+
title?: () => unknown
|
|
11
|
+
footer?: () => unknown
|
|
12
|
+
}
|
package/src/env.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
declare module '*.vue' {
|
|
4
|
+
import type { DefineComponent } from 'vue'
|
|
5
|
+
const component: DefineComponent<object, object, unknown>
|
|
6
|
+
export default component
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare module '*.css' {
|
|
10
|
+
const css: string
|
|
11
|
+
export default css
|
|
12
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ref, type Ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
export type LawThemeMode = 'light' | 'dark'
|
|
4
|
+
|
|
5
|
+
export interface UseLawThemeReturn {
|
|
6
|
+
mode: Ref<LawThemeMode>
|
|
7
|
+
setTheme: (theme: LawThemeMode) => void
|
|
8
|
+
toggleTheme: () => void
|
|
9
|
+
isDark: () => boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const THEME_ATTR = 'data-theme'
|
|
13
|
+
const DARK_CLASS = 'dark'
|
|
14
|
+
|
|
15
|
+
function applyTheme(theme: LawThemeMode) {
|
|
16
|
+
if (typeof document === 'undefined') return
|
|
17
|
+
|
|
18
|
+
const root = document.documentElement
|
|
19
|
+
|
|
20
|
+
if (theme === 'dark') {
|
|
21
|
+
root.setAttribute(THEME_ATTR, 'dark')
|
|
22
|
+
root.classList.add(DARK_CLASS)
|
|
23
|
+
} else {
|
|
24
|
+
root.removeAttribute(THEME_ATTR)
|
|
25
|
+
root.classList.remove(DARK_CLASS)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function detectTheme(): LawThemeMode {
|
|
30
|
+
if (typeof document === 'undefined') return 'light'
|
|
31
|
+
|
|
32
|
+
const root = document.documentElement
|
|
33
|
+
if (
|
|
34
|
+
root.getAttribute(THEME_ATTR) === 'dark'
|
|
35
|
+
|| root.classList.contains(DARK_CLASS)
|
|
36
|
+
) {
|
|
37
|
+
return 'dark'
|
|
38
|
+
}
|
|
39
|
+
return 'light'
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function useLawTheme(initial: LawThemeMode = 'light'): UseLawThemeReturn {
|
|
43
|
+
const mode = ref<LawThemeMode>(detectTheme() || initial)
|
|
44
|
+
|
|
45
|
+
function setTheme(theme: LawThemeMode) {
|
|
46
|
+
mode.value = theme
|
|
47
|
+
applyTheme(theme)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function toggleTheme() {
|
|
51
|
+
setTheme(mode.value === 'dark' ? 'light' : 'dark')
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function isDark() {
|
|
55
|
+
return mode.value === 'dark'
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
applyTheme(mode.value)
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
mode,
|
|
62
|
+
setTheme,
|
|
63
|
+
toggleTheme,
|
|
64
|
+
isDark,
|
|
65
|
+
}
|
|
66
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { App, Plugin } from 'vue'
|
|
2
|
+
import LawButton from './components/law-button/index.vue'
|
|
3
|
+
import LawDialog from './components/law-dialog/index.vue'
|
|
4
|
+
|
|
5
|
+
export { LawButton, LawDialog }
|
|
6
|
+
export { useLawTheme } from './hooks/use-law-theme'
|
|
7
|
+
export type { LawThemeMode, UseLawThemeReturn } from './hooks/use-law-theme'
|
|
8
|
+
export * from './utils'
|
|
9
|
+
export type {
|
|
10
|
+
LawButtonProps,
|
|
11
|
+
LawButtonEmits,
|
|
12
|
+
LawButtonSlots,
|
|
13
|
+
LawButtonSize,
|
|
14
|
+
LawButtonOwnProps,
|
|
15
|
+
} from './components/law-button/types'
|
|
16
|
+
export type {
|
|
17
|
+
LawDialogProps,
|
|
18
|
+
LawDialogEmits,
|
|
19
|
+
LawDialogSlots,
|
|
20
|
+
} from './components/law-dialog/types'
|
|
21
|
+
|
|
22
|
+
const components = [LawButton, LawDialog] as const
|
|
23
|
+
|
|
24
|
+
const LawUI: Plugin = {
|
|
25
|
+
install(app: App) {
|
|
26
|
+
components.forEach((component) => {
|
|
27
|
+
const name = component.name
|
|
28
|
+
if (name) {
|
|
29
|
+
app.component(name, component)
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default LawUI
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LawUI Theme Mapping Layer
|
|
3
|
+
* Maps Law0S Design Tokens (--law-*) to Element Plus (--el-*)
|
|
4
|
+
*/
|
|
5
|
+
@import "./variables.css";
|
|
6
|
+
|
|
7
|
+
:root,
|
|
8
|
+
:root.dark,
|
|
9
|
+
html.dark,
|
|
10
|
+
[data-theme="dark"] {
|
|
11
|
+
/* Brand & functional colors */
|
|
12
|
+
--el-color-primary: var(--law-color-primary);
|
|
13
|
+
--el-color-success: var(--law-color-success);
|
|
14
|
+
--el-color-warning: var(--law-color-warning);
|
|
15
|
+
--el-color-danger: var(--law-color-danger);
|
|
16
|
+
--el-color-error: var(--law-color-danger);
|
|
17
|
+
--el-color-info: var(--law-color-info);
|
|
18
|
+
|
|
19
|
+
--el-color-primary-light-3: var(--law-primary-300);
|
|
20
|
+
--el-color-primary-light-5: var(--law-primary-200);
|
|
21
|
+
--el-color-primary-light-7: var(--law-primary-100);
|
|
22
|
+
--el-color-primary-light-8: var(--law-primary-50);
|
|
23
|
+
--el-color-primary-light-9: var(--law-primary-50);
|
|
24
|
+
--el-color-primary-dark-2: var(--law-primary-600);
|
|
25
|
+
|
|
26
|
+
/* Typography */
|
|
27
|
+
--el-font-family: var(--law-font-family-zh);
|
|
28
|
+
--el-font-size-extra-large: var(--law-font-size-h1);
|
|
29
|
+
--el-font-size-large: var(--law-font-size-h3);
|
|
30
|
+
--el-font-size-medium: var(--law-font-size-h4);
|
|
31
|
+
--el-font-size-base: var(--law-font-size-body);
|
|
32
|
+
--el-font-size-small: var(--law-font-size-caption);
|
|
33
|
+
--el-font-size-extra-small: var(--law-font-size-mini);
|
|
34
|
+
--el-font-weight-primary: var(--law-font-weight-medium);
|
|
35
|
+
--el-font-line-height-primary: var(--law-line-height-body);
|
|
36
|
+
|
|
37
|
+
/* Text colors */
|
|
38
|
+
--el-text-color-primary: var(--law-text-primary);
|
|
39
|
+
--el-text-color-regular: var(--law-text-regular);
|
|
40
|
+
--el-text-color-secondary: var(--law-text-secondary);
|
|
41
|
+
--el-text-color-placeholder: var(--law-text-placeholder);
|
|
42
|
+
--el-text-color-disabled: var(--law-text-color-disabled);
|
|
43
|
+
|
|
44
|
+
/* Border */
|
|
45
|
+
--el-border-width: var(--law-border-width);
|
|
46
|
+
--el-border-color: var(--law-border-color);
|
|
47
|
+
--el-border-color-light: var(--law-border-color-light);
|
|
48
|
+
--el-border-color-lighter: var(--law-border-color-lighter);
|
|
49
|
+
--el-border-color-hover: var(--law-border-color);
|
|
50
|
+
|
|
51
|
+
/* Background & fill */
|
|
52
|
+
--el-bg-color: var(--law-bg-white);
|
|
53
|
+
--el-bg-color-page: var(--law-bg-page);
|
|
54
|
+
--el-bg-color-overlay: var(--law-bg-white);
|
|
55
|
+
--el-fill-color: var(--law-fill-color);
|
|
56
|
+
--el-fill-color-light: var(--law-fill-color-light);
|
|
57
|
+
--el-fill-color-lighter: var(--law-border-color-lighter);
|
|
58
|
+
--el-fill-color-blank: var(--law-fill-color-blank);
|
|
59
|
+
--el-disabled-bg-color: var(--law-bg-disabled);
|
|
60
|
+
--el-disabled-text-color: var(--law-text-placeholder);
|
|
61
|
+
--el-disabled-border-color: var(--law-border-color-light);
|
|
62
|
+
|
|
63
|
+
/* Radius */
|
|
64
|
+
--el-border-radius-base: var(--law-radius-sm);
|
|
65
|
+
--el-border-radius-small: var(--law-radius-sm);
|
|
66
|
+
--el-border-radius-round: var(--law-radius-lg);
|
|
67
|
+
|
|
68
|
+
/* Shadow */
|
|
69
|
+
--el-box-shadow: var(--law-box-shadow);
|
|
70
|
+
--el-box-shadow-light: var(--law-shadow-sm);
|
|
71
|
+
--el-box-shadow-lighter: var(--law-shadow-sm);
|
|
72
|
+
--el-box-shadow-dark: var(--law-shadow-lg);
|
|
73
|
+
|
|
74
|
+
/* Component size (align with Law button tokens) */
|
|
75
|
+
--el-component-size-large: var(--law-btn-size-lg);
|
|
76
|
+
--el-component-size: var(--law-btn-size-md);
|
|
77
|
+
--el-component-size-small: var(--law-btn-size-sm);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
:root.dark,
|
|
81
|
+
html.dark,
|
|
82
|
+
[data-theme="dark"] {
|
|
83
|
+
color-scheme: dark;
|
|
84
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Law0S Design System - Theme Variables
|
|
3
|
+
* Based on Law0S Design Specification
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
:root {
|
|
7
|
+
/* ========================================
|
|
8
|
+
Brand Color - 品牌色
|
|
9
|
+
======================================== */
|
|
10
|
+
--law-primary: #2664ff;
|
|
11
|
+
--law-color-primary: var(--law-primary);
|
|
12
|
+
--law-primary-900: #0a1654;
|
|
13
|
+
--law-primary-800: #0d214b;
|
|
14
|
+
--law-primary-700: #102e66;
|
|
15
|
+
--law-primary-600: #154089;
|
|
16
|
+
--law-primary-500: #1b57ad;
|
|
17
|
+
--law-primary-400: #2564ff;
|
|
18
|
+
--law-primary-300: #5584ff;
|
|
19
|
+
--law-primary-200: #89adff;
|
|
20
|
+
--law-primary-100: #bdd0ff;
|
|
21
|
+
--law-primary-50: #e8f0ff;
|
|
22
|
+
|
|
23
|
+
/* ========================================
|
|
24
|
+
Button Size - 按钮尺寸(含边框)
|
|
25
|
+
======================================== */
|
|
26
|
+
--law-btn-size-lg: 40px;
|
|
27
|
+
--law-btn-size-md: 32px;
|
|
28
|
+
--law-btn-size-sm: 28px;
|
|
29
|
+
|
|
30
|
+
/* ========================================
|
|
31
|
+
Tooltip - 文字提示
|
|
32
|
+
======================================== */
|
|
33
|
+
--law-tooltip-bg: #303133;
|
|
34
|
+
--law-tooltip-border: #303133;
|
|
35
|
+
--law-tooltip-color: #ffffff;
|
|
36
|
+
|
|
37
|
+
/* ========================================
|
|
38
|
+
Button Hover State - 按钮悬停状态
|
|
39
|
+
======================================== */
|
|
40
|
+
--law-btn-default-hover-bg: #f0f4ff;
|
|
41
|
+
--law-btn-default-hover-color: var(--law-primary);
|
|
42
|
+
--law-btn-primary-hover-bg: #1b51e0;
|
|
43
|
+
--law-btn-primary-hover-color: #ffffff;
|
|
44
|
+
--law-btn-info-hover-bg: #1b51e0;
|
|
45
|
+
--law-btn-info-hover-color: #ffffff;
|
|
46
|
+
--law-btn-success-hover-bg: #2ab45a;
|
|
47
|
+
--law-btn-success-hover-color: #ffffff;
|
|
48
|
+
--law-btn-warning-hover-bg: #e67326;
|
|
49
|
+
--law-btn-warning-hover-color: #ffffff;
|
|
50
|
+
--law-btn-danger-hover-bg: #d94a41;
|
|
51
|
+
--law-btn-danger-hover-color: #ffffff;
|
|
52
|
+
|
|
53
|
+
/* ========================================
|
|
54
|
+
Functional Color - 功能色
|
|
55
|
+
======================================== */
|
|
56
|
+
--law-color-info: #2664ff;
|
|
57
|
+
--law-color-success: #34c759;
|
|
58
|
+
--law-color-warning: #ff7f2c;
|
|
59
|
+
--law-color-danger: #ee5249;
|
|
60
|
+
|
|
61
|
+
/* ========================================
|
|
62
|
+
Text Color - 文字颜色(语义化)
|
|
63
|
+
======================================== */
|
|
64
|
+
--law-text-primary: #111111;
|
|
65
|
+
--law-text-regular: #434c59;
|
|
66
|
+
--law-text-secondary: #86899c;
|
|
67
|
+
--law-text-placeholder: #c2c6cc;
|
|
68
|
+
|
|
69
|
+
/* ========================================
|
|
70
|
+
Border Color - 边框色(语义化)
|
|
71
|
+
======================================== */
|
|
72
|
+
--law-border-width: 1px;
|
|
73
|
+
--law-border-color: #d8dce4;
|
|
74
|
+
--law-border-color-light: #eaedf6;
|
|
75
|
+
--law-border-color-lighter: #f4f5f7;
|
|
76
|
+
|
|
77
|
+
/* ========================================
|
|
78
|
+
Background Color - 背景色(语义化)
|
|
79
|
+
======================================== */
|
|
80
|
+
--law-bg-white: #ffffff;
|
|
81
|
+
--law-bg-page: #fafbfe;
|
|
82
|
+
--law-bg-card: #f4f7fc;
|
|
83
|
+
--law-bg-hover: #eaedf6;
|
|
84
|
+
--law-bg-fill: #ebebeb;
|
|
85
|
+
--law-bg-disabled: #d8dce4;
|
|
86
|
+
|
|
87
|
+
/* ========================================
|
|
88
|
+
AI Gradient - AI 渐变色
|
|
89
|
+
======================================== */
|
|
90
|
+
--law-ai-gradient-start: #a855f7;
|
|
91
|
+
--law-ai-gradient-end: #e8d5f5;
|
|
92
|
+
|
|
93
|
+
/* ========================================
|
|
94
|
+
Typography - 字体
|
|
95
|
+
======================================== */
|
|
96
|
+
--law-font-family-zh: "PingFang SC", "Microsoft YaHei", sans-serif;
|
|
97
|
+
--law-font-family-en:
|
|
98
|
+
-apple-system, "San Francisco", "Segoe UI", "Roboto", sans-serif;
|
|
99
|
+
--law-font-family-number: "Roboto", sans-serif;
|
|
100
|
+
|
|
101
|
+
--law-font-size-display: 30px;
|
|
102
|
+
--law-font-size-h1: 24px;
|
|
103
|
+
--law-font-size-h2: 20px;
|
|
104
|
+
--law-font-size-h3: 18px;
|
|
105
|
+
--law-font-size-h4: 16px;
|
|
106
|
+
--law-font-size-body: 14px;
|
|
107
|
+
--law-font-size-caption: 12px;
|
|
108
|
+
--law-font-size-mini: 10px;
|
|
109
|
+
|
|
110
|
+
--law-font-size-lg: var(--law-font-size-display);
|
|
111
|
+
--law-font-size-md: var(--law-font-size-body);
|
|
112
|
+
--law-font-size-sm: var(--law-font-size-caption);
|
|
113
|
+
--law-font-size-xs: var(--law-font-size-mini);
|
|
114
|
+
|
|
115
|
+
--law-line-height-display: 40px;
|
|
116
|
+
--law-line-height-h1: 36px;
|
|
117
|
+
--law-line-height-h2: 32px;
|
|
118
|
+
--law-line-height-h3: 28px;
|
|
119
|
+
--law-line-height-h4: 24px;
|
|
120
|
+
--law-line-height-body: 20px;
|
|
121
|
+
--law-line-height-caption: 18px;
|
|
122
|
+
--law-line-height-mini: 14px;
|
|
123
|
+
|
|
124
|
+
--law-font-weight-regular: 400;
|
|
125
|
+
--law-font-weight-medium: 500;
|
|
126
|
+
--law-font-weight-semibold: 600;
|
|
127
|
+
--law-font-weight-bold: 700;
|
|
128
|
+
|
|
129
|
+
--law-font-weight-normal: var(--law-font-weight-regular);
|
|
130
|
+
--law-font-weight-thick: var(--law-font-weight-semibold);
|
|
131
|
+
|
|
132
|
+
--law-text-color-primary: var(--law-text-primary);
|
|
133
|
+
--law-text-color-regular: var(--law-text-regular);
|
|
134
|
+
--law-text-color-secondary: var(--law-text-secondary);
|
|
135
|
+
--law-text-color-placeholder: var(--law-text-placeholder);
|
|
136
|
+
--law-text-color-disabled: var(--law-text-placeholder);
|
|
137
|
+
|
|
138
|
+
/* ========================================
|
|
139
|
+
Border Radius - 圆角
|
|
140
|
+
======================================== */
|
|
141
|
+
--law-radius-sm: 4px;
|
|
142
|
+
--law-radius-md: 8px;
|
|
143
|
+
--law-radius-lg: 12px;
|
|
144
|
+
--law-radius-full: 50%;
|
|
145
|
+
|
|
146
|
+
/* ========================================
|
|
147
|
+
Fill Color - 填充色
|
|
148
|
+
======================================== */
|
|
149
|
+
--law-fill-color: var(--law-bg-fill);
|
|
150
|
+
--law-fill-color-light: var(--law-bg-hover);
|
|
151
|
+
--law-fill-color-blank: var(--law-bg-white);
|
|
152
|
+
|
|
153
|
+
/* ========================================
|
|
154
|
+
Shadow - 阴影(亮色模式)
|
|
155
|
+
======================================== */
|
|
156
|
+
--law-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
|
|
157
|
+
--law-shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);
|
|
158
|
+
--law-shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.12);
|
|
159
|
+
--law-shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.16);
|
|
160
|
+
--law-box-shadow: var(--law-shadow-md);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* ========================================
|
|
164
|
+
Dark Mode - 暗色模式
|
|
165
|
+
======================================== */
|
|
166
|
+
[data-theme="dark"] {
|
|
167
|
+
--law-text-primary: #e5eaf3;
|
|
168
|
+
--law-text-regular: #cfd3dc;
|
|
169
|
+
--law-text-secondary: #8c8c8c;
|
|
170
|
+
--law-text-placeholder: #5c5c5c;
|
|
171
|
+
|
|
172
|
+
--law-border-color: #4c4d4f;
|
|
173
|
+
--law-border-color-light: #3a3a3c;
|
|
174
|
+
--law-border-color-lighter: #2d2d2f;
|
|
175
|
+
|
|
176
|
+
--law-bg-white: #1a1a1e;
|
|
177
|
+
--law-bg-page: #0a0a0c;
|
|
178
|
+
--law-bg-card: #141418;
|
|
179
|
+
--law-bg-hover: #1c1c22;
|
|
180
|
+
--law-bg-fill: #242428;
|
|
181
|
+
--law-bg-disabled: #1a1a1e;
|
|
182
|
+
|
|
183
|
+
--law-fill-color: #242428;
|
|
184
|
+
--law-fill-color-light: #1c1c22;
|
|
185
|
+
--law-fill-color-blank: var(--law-bg-white);
|
|
186
|
+
|
|
187
|
+
--law-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
|
|
188
|
+
--law-shadow-md: 0 4px 8px rgba(0, 0, 0, 0.32);
|
|
189
|
+
--law-shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.44);
|
|
190
|
+
--law-shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.56);
|
|
191
|
+
--law-box-shadow: var(--law-shadow-md);
|
|
192
|
+
}
|