@yunlefun/vue 0.4.2 → 0.6.0
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 +6 -0
- package/components/YlfAccordion.vue +12 -7
- package/components/YlfAgentCard.vue +108 -0
- package/components/YlfAgentStatus.vue +69 -0
- package/components/YlfAgentTask.vue +85 -0
- package/components/YlfButton.vue +145 -28
- package/components/YlfCard.vue +10 -4
- package/components/YlfCheckbox.vue +70 -7
- package/components/YlfCloud.vue +193 -0
- package/components/YlfDialog.vue +53 -21
- package/components/YlfDropdownMenu.vue +41 -5
- package/components/YlfInput.vue +67 -0
- package/components/YlfLogo.vue +7 -5
- package/components/YlfNavigation.vue +84 -0
- package/components/YlfNavigationLink.vue +59 -0
- package/components/YlfNavigationTrigger.vue +53 -0
- package/components/YlfPopover.vue +43 -7
- package/components/YlfRadioGroup.vue +41 -6
- package/components/YlfSegmentedControl.vue +80 -10
- package/components/YlfSelect.vue +43 -12
- package/components/YlfSlider.vue +16 -5
- package/components/YlfSwitch.vue +30 -4
- package/components/YlfTabs.vue +12 -4
- package/components/YlfTooltip.vue +29 -4
- package/components/_navigation.scss +38 -0
- package/components/accordion/demo.vue +1 -1
- package/components/agent-card/demo.vue +17 -0
- package/components/agent-card/index.md +25 -0
- package/components/agent-status/demo.vue +38 -0
- package/components/agent-status/index.md +20 -0
- package/components/agent-task/demo.vue +15 -0
- package/components/agent-task/index.md +25 -0
- package/components/agent.ts +2 -0
- package/components/button/demo.vue +21 -0
- package/components/button/index.md +20 -11
- package/components/cloud/demo.vue +92 -0
- package/components/cloud/index.md +66 -0
- package/components/cloud.ts +4 -0
- package/components/input/demo.vue +22 -0
- package/components/input/index.md +19 -0
- package/components/navigation/demo.vue +104 -0
- package/components/navigation/index.md +90 -0
- package/components/navigation-indicator.ts +114 -0
- package/dist/ag-ui.cjs +132 -0
- package/dist/ag-ui.d.cts +25 -0
- package/dist/ag-ui.d.mts +25 -0
- package/dist/ag-ui.d.ts +25 -0
- package/dist/ag-ui.mjs +130 -0
- package/dist/components/YlfAgentCard.vue.d.ts +24 -0
- package/dist/components/YlfAgentStatus.vue.d.ts +13 -0
- package/dist/components/YlfAgentTask.vue.d.ts +23 -0
- package/dist/components/YlfAvatar.vue.d.ts +1 -1
- package/dist/components/YlfButton.vue.d.ts +8 -5
- package/dist/components/YlfCloud.vue.d.ts +15 -0
- package/dist/components/YlfDialog.vue.d.ts +5 -5
- package/dist/components/YlfDropdownMenu.vue.d.ts +2 -2
- package/dist/components/YlfInput.vue.d.ts +18 -0
- package/dist/components/YlfNavigation.vue.d.ts +23 -0
- package/dist/components/YlfNavigationLink.vue.d.ts +21 -0
- package/dist/components/YlfNavigationTrigger.vue.d.ts +18 -0
- package/dist/components/YlfPopover.vue.d.ts +3 -3
- package/dist/components/YlfProgress.vue.d.ts +1 -1
- package/dist/components/YlfSeparator.vue.d.ts +2 -2
- package/dist/components/YlfSwitch.vue.d.ts +1 -1
- package/dist/components/YlfTabs.vue.d.ts +3 -3
- package/dist/components/YlfTooltip.vue.d.ts +3 -3
- package/dist/components/agent.d.ts +2 -0
- package/dist/components/cloud.d.ts +3 -0
- package/dist/components/navigation-indicator.d.ts +14 -0
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +9 -2
- package/dist/index.d.mts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.mjs +3 -1
- package/package.json +16 -6
package/README.md
CHANGED
|
@@ -47,3 +47,9 @@ export default defineNuxtConfig({
|
|
|
47
47
|
`YlfAiPromptLauncher` 统一元宝、豆包、DeepSeek、ChatGPT、Claude 与 Cursor 的 logo、带提示词跳转和完整复制兜底。`@yunlefun/vue/ai-prompt` 提供可用于 CMS 主进程的纯链接构建函数;Vue 组件通过 `launch` / `copyText` 对接宿主。
|
|
48
48
|
|
|
49
49
|
接口、站点能力与接入示例见 [AI 提示词入口](./components/ai-prompt-launcher/index.md)。
|
|
50
|
+
|
|
51
|
+
## AG-UI 可选接入
|
|
52
|
+
|
|
53
|
+
从 0.5.0 起,`@yunlefun/vue/ag-ui` 提供 `useAgUiAgent(agent)`,将官方 `@ag-ui/client` 的流式消息、共享状态、取消、工具结果与 interrupt/resume 映射为 Vue 状态。仅使用此入口时才需要安装 `@ag-ui/client`;普通组件与 Nuxt 集成不依赖它。
|
|
54
|
+
|
|
55
|
+
工具操作由宿主校验并显式执行。设置 composable 不连接服务,Vue scope 销毁时自动取消与退订。双语演示、固定发行包和后端连接示例见 [AG-UI 接入](https://design.yunle.fun/guide/ag-ui.html)。
|
|
@@ -85,10 +85,14 @@ const model = defineModel<string | string[]>()
|
|
|
85
85
|
background: transparent;
|
|
86
86
|
border: none;
|
|
87
87
|
cursor: pointer;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
min-height: var(--ylf-touch-target, 44px);
|
|
89
|
+
overflow-wrap: anywhere;
|
|
90
|
+
transition: background var(--ylf-duration-fast, 160ms) var(--ylf-ease-standard, ease);
|
|
91
|
+
|
|
92
|
+
@media (hover: hover) and (pointer: fine) {
|
|
93
|
+
&:hover {
|
|
94
|
+
background: var(--ylf-c-bg-soft, #f1f5f9);
|
|
95
|
+
}
|
|
92
96
|
}
|
|
93
97
|
|
|
94
98
|
&[data-state='open'] {
|
|
@@ -112,7 +116,7 @@ const model = defineModel<string | string[]>()
|
|
|
112
116
|
width: 18px;
|
|
113
117
|
height: 18px;
|
|
114
118
|
color: var(--ylf-c-text-3, #64748b);
|
|
115
|
-
transition: transform
|
|
119
|
+
transition: transform var(--ylf-duration-normal, 240ms) var(--ylf-ease-standard, ease);
|
|
116
120
|
}
|
|
117
121
|
|
|
118
122
|
.ylf-accordion__trigger[data-state='open'] .ylf-accordion__chevron {
|
|
@@ -126,11 +130,11 @@ const model = defineModel<string | string[]>()
|
|
|
126
130
|
color: var(--ylf-c-text-2, #475569);
|
|
127
131
|
|
|
128
132
|
&[data-state='open'] {
|
|
129
|
-
animation: ylf-acc-down
|
|
133
|
+
animation: ylf-acc-down var(--ylf-duration-enter, 240ms) var(--ylf-ease-standard, ease);
|
|
130
134
|
}
|
|
131
135
|
|
|
132
136
|
&[data-state='closed'] {
|
|
133
|
-
animation: ylf-acc-up
|
|
137
|
+
animation: ylf-acc-up var(--ylf-duration-exit, 160ms) var(--ylf-ease-standard, ease);
|
|
134
138
|
}
|
|
135
139
|
}
|
|
136
140
|
|
|
@@ -164,6 +168,7 @@ const model = defineModel<string | string[]>()
|
|
|
164
168
|
animation: none;
|
|
165
169
|
}
|
|
166
170
|
|
|
171
|
+
.ylf-accordion__trigger,
|
|
167
172
|
.ylf-accordion__chevron {
|
|
168
173
|
transition: none;
|
|
169
174
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { YlfAgentState } from './agent'
|
|
3
|
+
import { useId } from 'vue'
|
|
4
|
+
import YlfAgentStatus from './YlfAgentStatus.vue'
|
|
5
|
+
|
|
6
|
+
defineProps<{
|
|
7
|
+
name: string
|
|
8
|
+
description?: string
|
|
9
|
+
state: YlfAgentState
|
|
10
|
+
statusLabel: string
|
|
11
|
+
}>()
|
|
12
|
+
const titleId = useId()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<article class="ylf-agent-card" :aria-labelledby="titleId">
|
|
17
|
+
<div class="ylf-agent-card__header">
|
|
18
|
+
<div class="ylf-agent-card__avatar">
|
|
19
|
+
<slot name="avatar">
|
|
20
|
+
<svg viewBox="0 0 32 32" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true">
|
|
21
|
+
<path d="M16 4v4M12 4h8M6 18H3m26 0h-3" />
|
|
22
|
+
<rect x="6" y="8" width="20" height="19" rx="7" />
|
|
23
|
+
<path d="M12 15v3m8-3v3m-7 5h6" />
|
|
24
|
+
</svg>
|
|
25
|
+
</slot>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="ylf-agent-card__identity">
|
|
28
|
+
<h2 :id="titleId" class="ylf-agent-card__name">
|
|
29
|
+
{{ name }}
|
|
30
|
+
</h2>
|
|
31
|
+
<p v-if="description" class="ylf-agent-card__description">
|
|
32
|
+
{{ description }}
|
|
33
|
+
</p>
|
|
34
|
+
</div>
|
|
35
|
+
<YlfAgentStatus :state="state" :label="statusLabel" />
|
|
36
|
+
</div>
|
|
37
|
+
<div v-if="$slots.default" class="ylf-agent-card__body">
|
|
38
|
+
<slot />
|
|
39
|
+
</div>
|
|
40
|
+
<div v-if="$slots.actions" class="ylf-agent-card__actions">
|
|
41
|
+
<slot name="actions" />
|
|
42
|
+
</div>
|
|
43
|
+
</article>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<style scoped>
|
|
47
|
+
.ylf-agent-card {
|
|
48
|
+
min-width: 0;
|
|
49
|
+
padding: var(--ylf-space-6, 24px);
|
|
50
|
+
border: 1px solid var(--ylf-c-border, #e2e8f0);
|
|
51
|
+
border-radius: var(--ylf-radius-lg, 20px);
|
|
52
|
+
background: var(--ylf-c-surface, #fff);
|
|
53
|
+
color: var(--ylf-c-text, #0f172a);
|
|
54
|
+
box-shadow: var(--ylf-shadow-control, none);
|
|
55
|
+
font-family: var(--ylf-font-body, inherit);
|
|
56
|
+
}
|
|
57
|
+
.ylf-agent-card__header {
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
flex-wrap: wrap;
|
|
61
|
+
gap: var(--ylf-space-4, 16px);
|
|
62
|
+
}
|
|
63
|
+
.ylf-agent-card__avatar {
|
|
64
|
+
display: grid;
|
|
65
|
+
place-items: center;
|
|
66
|
+
flex: none;
|
|
67
|
+
width: 52px;
|
|
68
|
+
height: 52px;
|
|
69
|
+
border-radius: var(--ylf-radius, 14px);
|
|
70
|
+
background: var(--ylf-c-brand-soft, #eff6ff);
|
|
71
|
+
color: var(--ylf-c-brand, #2563eb);
|
|
72
|
+
}
|
|
73
|
+
.ylf-agent-card__avatar svg {
|
|
74
|
+
width: 32px;
|
|
75
|
+
height: 32px;
|
|
76
|
+
}
|
|
77
|
+
.ylf-agent-card__identity {
|
|
78
|
+
flex: 1 1 160px;
|
|
79
|
+
min-width: 0;
|
|
80
|
+
}
|
|
81
|
+
.ylf-agent-card__name {
|
|
82
|
+
margin: 0;
|
|
83
|
+
font-family: var(--ylf-font-heading, inherit);
|
|
84
|
+
font-size: var(--ylf-text-lg, 20px);
|
|
85
|
+
line-height: var(--ylf-leading-heading, 1.25);
|
|
86
|
+
overflow-wrap: anywhere;
|
|
87
|
+
}
|
|
88
|
+
.ylf-agent-card__description {
|
|
89
|
+
margin: var(--ylf-space-2, 8px) 0 0;
|
|
90
|
+
color: var(--ylf-c-text-2, #475569);
|
|
91
|
+
font-size: var(--ylf-text-sm, 14px);
|
|
92
|
+
line-height: 1.6;
|
|
93
|
+
overflow-wrap: anywhere;
|
|
94
|
+
}
|
|
95
|
+
.ylf-agent-card__body {
|
|
96
|
+
margin-top: var(--ylf-space-6, 24px);
|
|
97
|
+
min-width: 0;
|
|
98
|
+
}
|
|
99
|
+
.ylf-agent-card__actions {
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
flex-wrap: wrap;
|
|
103
|
+
gap: var(--ylf-space-3, 12px);
|
|
104
|
+
margin-top: var(--ylf-space-6, 24px);
|
|
105
|
+
padding-top: var(--ylf-space-4, 16px);
|
|
106
|
+
border-top: 1px solid var(--ylf-c-border, #e2e8f0);
|
|
107
|
+
}
|
|
108
|
+
</style>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { YlfAgentState } from './agent'
|
|
3
|
+
|
|
4
|
+
withDefaults(defineProps<{
|
|
5
|
+
state: YlfAgentState
|
|
6
|
+
/** Localized, truthful status text supplied by the application. */
|
|
7
|
+
label: string
|
|
8
|
+
/** Opt in for a single live summary, rather than every polled indicator. */
|
|
9
|
+
live?: boolean
|
|
10
|
+
}>(), { live: false })
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<span class="ylf-agent-status" :data-state="state" :role="live ? 'status' : undefined" :aria-atomic="live || undefined">
|
|
15
|
+
<span class="ylf-agent-status__mark" aria-hidden="true" />
|
|
16
|
+
<span>{{ label }}</span>
|
|
17
|
+
</span>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<style scoped>
|
|
21
|
+
.ylf-agent-status {
|
|
22
|
+
--agent-color: var(--ylf-c-text-2, #475569);
|
|
23
|
+
--agent-surface: var(--ylf-c-bg-soft, #f1f5f9);
|
|
24
|
+
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
gap: var(--ylf-space-2, 8px);
|
|
28
|
+
max-width: 100%;
|
|
29
|
+
padding: 5px 10px;
|
|
30
|
+
border-radius: var(--ylf-radius-pill, 999px);
|
|
31
|
+
background: var(--agent-surface);
|
|
32
|
+
color: var(--agent-color);
|
|
33
|
+
font-family: var(--ylf-font-body, inherit);
|
|
34
|
+
font-size: var(--ylf-text-xs, 12px);
|
|
35
|
+
line-height: 1.5;
|
|
36
|
+
overflow-wrap: anywhere;
|
|
37
|
+
}
|
|
38
|
+
.ylf-agent-status[data-state='ready'] {
|
|
39
|
+
--agent-color: var(--ylf-status-success-text, #166534);
|
|
40
|
+
--agent-surface: var(--ylf-status-success-soft, #dcfce7);
|
|
41
|
+
}
|
|
42
|
+
.ylf-agent-status[data-state='connecting'],
|
|
43
|
+
.ylf-agent-status[data-state='working'] {
|
|
44
|
+
--agent-color: var(--ylf-c-brand, #2563eb);
|
|
45
|
+
--agent-surface: var(--ylf-c-brand-soft, #eff6ff);
|
|
46
|
+
}
|
|
47
|
+
.ylf-agent-status[data-state='waiting'] {
|
|
48
|
+
--agent-color: var(--ylf-status-warning-text, #854d0e);
|
|
49
|
+
--agent-surface: var(--ylf-status-warning-soft, #fef9c3);
|
|
50
|
+
}
|
|
51
|
+
.ylf-agent-status[data-state='error'] {
|
|
52
|
+
--agent-color: var(--ylf-status-danger-text, #9a3412);
|
|
53
|
+
--agent-surface: var(--ylf-status-danger-soft, #ffede6);
|
|
54
|
+
}
|
|
55
|
+
.ylf-agent-status__mark {
|
|
56
|
+
flex: none;
|
|
57
|
+
width: 7px;
|
|
58
|
+
height: 7px;
|
|
59
|
+
border: 1.5px solid currentColor;
|
|
60
|
+
border-radius: 50%;
|
|
61
|
+
}
|
|
62
|
+
.ylf-agent-status[data-state='ready'] .ylf-agent-status__mark,
|
|
63
|
+
.ylf-agent-status[data-state='working'] .ylf-agent-status__mark {
|
|
64
|
+
background: currentColor;
|
|
65
|
+
}
|
|
66
|
+
.ylf-agent-status[data-state='waiting'] .ylf-agent-status__mark {
|
|
67
|
+
border-radius: 2px;
|
|
68
|
+
}
|
|
69
|
+
</style>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { YlfAgentState } from './agent'
|
|
3
|
+
import { useId } from 'vue'
|
|
4
|
+
import YlfAgentStatus from './YlfAgentStatus.vue'
|
|
5
|
+
|
|
6
|
+
defineProps<{
|
|
7
|
+
title: string
|
|
8
|
+
state: YlfAgentState
|
|
9
|
+
statusLabel: string
|
|
10
|
+
taskId?: string
|
|
11
|
+
description?: string
|
|
12
|
+
}>()
|
|
13
|
+
const titleId = useId()
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<section class="ylf-agent-task" :aria-labelledby="titleId">
|
|
18
|
+
<div class="ylf-agent-task__header">
|
|
19
|
+
<h3 :id="titleId" class="ylf-agent-task__title">
|
|
20
|
+
{{ title }}
|
|
21
|
+
</h3>
|
|
22
|
+
<YlfAgentStatus :state="state" :label="statusLabel" />
|
|
23
|
+
</div>
|
|
24
|
+
<code v-if="taskId" class="ylf-agent-task__id">{{ taskId }}</code>
|
|
25
|
+
<p v-if="description" class="ylf-agent-task__description">
|
|
26
|
+
{{ description }}
|
|
27
|
+
</p>
|
|
28
|
+
<div v-if="$slots.default" class="ylf-agent-task__body">
|
|
29
|
+
<slot />
|
|
30
|
+
</div>
|
|
31
|
+
<div v-if="$slots.actions" class="ylf-agent-task__actions">
|
|
32
|
+
<slot name="actions" />
|
|
33
|
+
</div>
|
|
34
|
+
</section>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<style scoped>
|
|
38
|
+
.ylf-agent-task {
|
|
39
|
+
min-width: 0;
|
|
40
|
+
padding: var(--ylf-space-4, 16px);
|
|
41
|
+
border: 1px solid var(--ylf-c-border, #e2e8f0);
|
|
42
|
+
border-radius: var(--ylf-radius, 14px);
|
|
43
|
+
color: var(--ylf-c-text, #0f172a);
|
|
44
|
+
background: var(--ylf-c-surface-raised, #f6f9ff);
|
|
45
|
+
font-family: var(--ylf-font-body, inherit);
|
|
46
|
+
}
|
|
47
|
+
.ylf-agent-task__header {
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
flex-wrap: wrap;
|
|
51
|
+
gap: var(--ylf-space-3, 12px);
|
|
52
|
+
justify-content: space-between;
|
|
53
|
+
}
|
|
54
|
+
.ylf-agent-task__title {
|
|
55
|
+
margin: 0;
|
|
56
|
+
font-size: var(--ylf-text-sm, 14px);
|
|
57
|
+
font-weight: 600;
|
|
58
|
+
line-height: 1.5;
|
|
59
|
+
overflow-wrap: anywhere;
|
|
60
|
+
}
|
|
61
|
+
.ylf-agent-task__id {
|
|
62
|
+
display: block;
|
|
63
|
+
margin-top: var(--ylf-space-3, 12px);
|
|
64
|
+
font-family: var(--ylf-font-mono, monospace);
|
|
65
|
+
font-size: var(--ylf-text-xs, 12px);
|
|
66
|
+
color: var(--ylf-c-text-2, #475569);
|
|
67
|
+
overflow-wrap: anywhere;
|
|
68
|
+
}
|
|
69
|
+
.ylf-agent-task__description {
|
|
70
|
+
margin: var(--ylf-space-3, 12px) 0 0;
|
|
71
|
+
color: var(--ylf-c-text-2, #475569);
|
|
72
|
+
font-size: var(--ylf-text-sm, 14px);
|
|
73
|
+
line-height: var(--ylf-leading-body, 1.75);
|
|
74
|
+
overflow-wrap: anywhere;
|
|
75
|
+
}
|
|
76
|
+
.ylf-agent-task__body,
|
|
77
|
+
.ylf-agent-task__actions {
|
|
78
|
+
margin-top: var(--ylf-space-4, 16px);
|
|
79
|
+
}
|
|
80
|
+
.ylf-agent-task__actions {
|
|
81
|
+
display: flex;
|
|
82
|
+
flex-wrap: wrap;
|
|
83
|
+
gap: var(--ylf-space-3, 12px);
|
|
84
|
+
}
|
|
85
|
+
</style>
|
package/components/YlfButton.vue
CHANGED
|
@@ -4,6 +4,7 @@ import { computed } from 'vue'
|
|
|
4
4
|
|
|
5
5
|
type ButtonVariant
|
|
6
6
|
= | 'primary' // 晴空蓝实色(主操作)
|
|
7
|
+
| 'hero' // 首页与品牌场景的主入口
|
|
7
8
|
| 'accent' // 高饱和纯色强调
|
|
8
9
|
| 'aurora' // @deprecated 使用 accent;旧调用映射到纯色
|
|
9
10
|
| 'secondary' // 描边
|
|
@@ -13,7 +14,7 @@ type ButtonVariant
|
|
|
13
14
|
| 'warning'
|
|
14
15
|
| 'danger'
|
|
15
16
|
|
|
16
|
-
type ButtonSize = 'sm' | 'md' | 'lg'
|
|
17
|
+
type ButtonSize = 'sm' | 'md' | 'lg' | 'xl'
|
|
17
18
|
|
|
18
19
|
const props = withDefaults(defineProps<{
|
|
19
20
|
variant?: ButtonVariant
|
|
@@ -22,6 +23,8 @@ const props = withDefaults(defineProps<{
|
|
|
22
23
|
/** accent 与状态变体的强调程度 */
|
|
23
24
|
appearance?: YlfColorAppearance
|
|
24
25
|
size?: ButtonSize
|
|
26
|
+
/** Square control; provide an aria-label for the icon. */
|
|
27
|
+
iconOnly?: boolean
|
|
25
28
|
/** 胶囊圆角,默认开启(云是软的) */
|
|
26
29
|
round?: boolean
|
|
27
30
|
/** 占满整行宽度 */
|
|
@@ -35,6 +38,7 @@ const props = withDefaults(defineProps<{
|
|
|
35
38
|
tone: 'blue',
|
|
36
39
|
appearance: 'solid',
|
|
37
40
|
size: 'md',
|
|
41
|
+
iconOnly: false,
|
|
38
42
|
round: true,
|
|
39
43
|
block: false,
|
|
40
44
|
disabled: false,
|
|
@@ -50,6 +54,7 @@ const classes = computed(() => [
|
|
|
50
54
|
`is-${props.appearance}`,
|
|
51
55
|
{
|
|
52
56
|
'is-round': props.round,
|
|
57
|
+
'is-icon-only': props.iconOnly,
|
|
53
58
|
'is-block': props.block,
|
|
54
59
|
'is-loading': props.loading,
|
|
55
60
|
'is-disabled': props.disabled,
|
|
@@ -69,6 +74,7 @@ function onClick(e: MouseEvent) {
|
|
|
69
74
|
class="ylf-button"
|
|
70
75
|
:class="classes"
|
|
71
76
|
:data-ylf-tone="tone"
|
|
77
|
+
:type="tag === 'button' ? 'button' : undefined"
|
|
72
78
|
:disabled="tag === 'button' ? (disabled || loading) : undefined"
|
|
73
79
|
:aria-busy="loading || undefined"
|
|
74
80
|
@click="onClick"
|
|
@@ -84,6 +90,8 @@ function onClick(e: MouseEvent) {
|
|
|
84
90
|
--_radius: var(--ylf-radius, 14px);
|
|
85
91
|
--_fill: var(--ylf-c-brand, #2563eb);
|
|
86
92
|
|
|
93
|
+
box-sizing: border-box;
|
|
94
|
+
max-width: 100%;
|
|
87
95
|
display: inline-flex;
|
|
88
96
|
align-items: center;
|
|
89
97
|
justify-content: center;
|
|
@@ -93,12 +101,15 @@ function onClick(e: MouseEvent) {
|
|
|
93
101
|
font-family: var(--ylf-font-body, inherit);
|
|
94
102
|
font-weight: 600;
|
|
95
103
|
line-height: 1;
|
|
96
|
-
white-space:
|
|
104
|
+
white-space: normal;
|
|
105
|
+
overflow-wrap: anywhere;
|
|
106
|
+
touch-action: manipulation;
|
|
107
|
+
-webkit-tap-highlight-color: transparent;
|
|
97
108
|
cursor: pointer;
|
|
98
109
|
user-select: none;
|
|
99
110
|
text-decoration: none;
|
|
100
111
|
transition:
|
|
101
|
-
transform var(--ylf-duration-
|
|
112
|
+
transform var(--ylf-duration-slow, 480ms) var(--ylf-ease-spring, var(--ylf-ease-standard, ease)),
|
|
102
113
|
box-shadow var(--ylf-duration-normal, 240ms) var(--ylf-ease-standard, ease),
|
|
103
114
|
background var(--ylf-duration-normal, 240ms) var(--ylf-ease-standard, ease),
|
|
104
115
|
color var(--ylf-duration-fast, 160ms) var(--ylf-ease-standard, ease),
|
|
@@ -137,6 +148,69 @@ function onClick(e: MouseEvent) {
|
|
|
137
148
|
font-size: 17px;
|
|
138
149
|
}
|
|
139
150
|
|
|
151
|
+
&--xl {
|
|
152
|
+
--_min-height: 56px;
|
|
153
|
+
min-height: var(--_min-height);
|
|
154
|
+
padding: 16px 28px;
|
|
155
|
+
font-size: 16px;
|
|
156
|
+
line-height: 22px;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&.is-icon-only {
|
|
160
|
+
width: 36px;
|
|
161
|
+
height: 36px;
|
|
162
|
+
min-height: 36px;
|
|
163
|
+
flex: none;
|
|
164
|
+
padding: 0;
|
|
165
|
+
font-size: 18px;
|
|
166
|
+
|
|
167
|
+
&.ylf-button--sm {
|
|
168
|
+
width: 32px;
|
|
169
|
+
height: 32px;
|
|
170
|
+
min-height: 32px;
|
|
171
|
+
font-size: 16px;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
&.ylf-button--lg,
|
|
175
|
+
&.ylf-button--xl {
|
|
176
|
+
width: 44px;
|
|
177
|
+
height: 44px;
|
|
178
|
+
min-height: 44px;
|
|
179
|
+
font-size: 20px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
&:focus-visible {
|
|
183
|
+
outline-offset: -2px;
|
|
184
|
+
box-shadow: none;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Opt-in brand entrance; everyday primary actions keep their solid appearance.
|
|
189
|
+
&--hero {
|
|
190
|
+
color: var(--ylf-hero-foreground, #fff);
|
|
191
|
+
background: var(--ylf-hero-background, linear-gradient(115deg, #2563eb, #0f74b8 58%, #0369a1));
|
|
192
|
+
border-color: var(--ylf-hero-border, rgb(255 255 255 / 0.16));
|
|
193
|
+
box-shadow: var(--ylf-hero-shadow, inset 0 1px 0 rgb(255 255 255 / 0.24), 0 12px 26px -14px rgb(3 105 161 / 0.58));
|
|
194
|
+
|
|
195
|
+
@media (hover: hover) and (pointer: fine) {
|
|
196
|
+
&:hover:not(.is-disabled, .is-loading, :disabled) {
|
|
197
|
+
background: var(--ylf-hero-background-hover, linear-gradient(115deg, #1d4ed8, #096ba9 58%, #075985));
|
|
198
|
+
box-shadow: var(
|
|
199
|
+
--ylf-hero-shadow-hover,
|
|
200
|
+
inset 0 1px 0 rgb(255 255 255 / 0.3),
|
|
201
|
+
0 14px 30px -14px rgb(3 105 161 / 0.58)
|
|
202
|
+
);
|
|
203
|
+
transform: translateY(var(--ylf-hover-lift, -1px));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
&:focus-visible {
|
|
208
|
+
outline: 2px solid var(--ylf-hero-foreground, #fff);
|
|
209
|
+
outline-offset: 3px;
|
|
210
|
+
box-shadow: 0 0 0 5px var(--ylf-hero-end, #0369a1);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
140
214
|
// --- primary:晴空蓝实色(主操作,单色不花) ---
|
|
141
215
|
&--primary {
|
|
142
216
|
color: var(--ylf-c-text-on-accent, #fff);
|
|
@@ -147,13 +221,15 @@ function onClick(e: MouseEvent) {
|
|
|
147
221
|
0 2px 0 color-mix(in srgb, var(--_fill) 80%, #000),
|
|
148
222
|
0 6px 14px -6px color-mix(in srgb, var(--_fill) 40%, transparent);
|
|
149
223
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
224
|
+
@media (hover: hover) and (pointer: fine) {
|
|
225
|
+
&:hover:not(.is-disabled, .is-loading, :disabled) {
|
|
226
|
+
background: var(--ylf-c-brand-hover, #1d4ed8);
|
|
227
|
+
transform: translateY(var(--ylf-hover-lift, -1px));
|
|
228
|
+
box-shadow:
|
|
229
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.22),
|
|
230
|
+
0 3px 0 color-mix(in srgb, var(--_fill) 80%, #000),
|
|
231
|
+
0 8px 18px -6px color-mix(in srgb, var(--_fill) 35%, transparent);
|
|
232
|
+
}
|
|
157
233
|
}
|
|
158
234
|
}
|
|
159
235
|
|
|
@@ -172,8 +248,10 @@ function onClick(e: MouseEvent) {
|
|
|
172
248
|
inset 0 1px 0 rgba(255, 255, 255, 0.2),
|
|
173
249
|
0 2px 0 color-mix(in srgb, var(--_fill) 78%, #000);
|
|
174
250
|
|
|
175
|
-
|
|
176
|
-
|
|
251
|
+
@media (hover: hover) and (pointer: fine) {
|
|
252
|
+
&:hover:not(.is-disabled, .is-loading, :disabled) {
|
|
253
|
+
background: var(--ylf-accent-hover, var(--ylf-c-brand-hover, #1d4ed8));
|
|
254
|
+
}
|
|
177
255
|
}
|
|
178
256
|
}
|
|
179
257
|
|
|
@@ -184,10 +262,12 @@ function onClick(e: MouseEvent) {
|
|
|
184
262
|
border-color: var(--ylf-c-border-strong, #cbd5e1);
|
|
185
263
|
box-shadow: var(--ylf-shadow-control);
|
|
186
264
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
265
|
+
@media (hover: hover) and (pointer: fine) {
|
|
266
|
+
&:hover:not(.is-disabled, .is-loading, :disabled) {
|
|
267
|
+
color: var(--ylf-c-brand, #2563eb);
|
|
268
|
+
border-color: var(--ylf-c-brand, #2563eb);
|
|
269
|
+
transform: translateY(var(--ylf-hover-lift, -1px));
|
|
270
|
+
}
|
|
191
271
|
}
|
|
192
272
|
}
|
|
193
273
|
|
|
@@ -197,9 +277,11 @@ function onClick(e: MouseEvent) {
|
|
|
197
277
|
background: var(--ylf-c-brand-soft, #eff6ff);
|
|
198
278
|
border-color: color-mix(in srgb, var(--ylf-c-brand, #2563eb) 12%, transparent);
|
|
199
279
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
280
|
+
@media (hover: hover) and (pointer: fine) {
|
|
281
|
+
&:hover:not(.is-disabled, .is-loading, :disabled) {
|
|
282
|
+
transform: translateY(var(--ylf-hover-lift, -1px));
|
|
283
|
+
box-shadow: var(--ylf-shadow-sm, 0 2px 8px -2px rgba(15, 23, 42, 0.12));
|
|
284
|
+
}
|
|
203
285
|
}
|
|
204
286
|
}
|
|
205
287
|
|
|
@@ -208,7 +290,14 @@ function onClick(e: MouseEvent) {
|
|
|
208
290
|
color: var(--ylf-c-text-2, #475569);
|
|
209
291
|
background: transparent;
|
|
210
292
|
|
|
211
|
-
|
|
293
|
+
@media (hover: hover) and (pointer: fine) {
|
|
294
|
+
&:hover:not(.is-disabled, .is-loading, :disabled) {
|
|
295
|
+
color: var(--ylf-c-brand, #2563eb);
|
|
296
|
+
background: var(--ylf-c-brand-soft, #eff6ff);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
&[aria-pressed='true'] {
|
|
212
301
|
color: var(--ylf-c-brand, #2563eb);
|
|
213
302
|
background: var(--ylf-c-brand-soft, #eff6ff);
|
|
214
303
|
}
|
|
@@ -226,8 +315,10 @@ function onClick(e: MouseEvent) {
|
|
|
226
315
|
color: var(--ylf-status-#{$status}-on, $on);
|
|
227
316
|
background: var(--ylf-status-#{$status}, $fill);
|
|
228
317
|
|
|
229
|
-
|
|
230
|
-
|
|
318
|
+
@media (hover: hover) and (pointer: fine) {
|
|
319
|
+
&:hover:not(.is-disabled, .is-loading, :disabled) {
|
|
320
|
+
background: var(--ylf-status-#{$status}-hover, $hover);
|
|
321
|
+
}
|
|
231
322
|
}
|
|
232
323
|
}
|
|
233
324
|
}
|
|
@@ -242,9 +333,11 @@ function onClick(e: MouseEvent) {
|
|
|
242
333
|
color: var(--_text);
|
|
243
334
|
box-shadow: none;
|
|
244
335
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
336
|
+
@media (hover: hover) and (pointer: fine) {
|
|
337
|
+
&:hover:not(.is-disabled, .is-loading, :disabled) {
|
|
338
|
+
background: var(--_soft);
|
|
339
|
+
border-color: var(--_text);
|
|
340
|
+
}
|
|
248
341
|
}
|
|
249
342
|
|
|
250
343
|
&:focus-visible {
|
|
@@ -264,8 +357,9 @@ function onClick(e: MouseEvent) {
|
|
|
264
357
|
}
|
|
265
358
|
|
|
266
359
|
// --- 状态 ---
|
|
267
|
-
&:active:not(.is-disabled, .is-loading) {
|
|
268
|
-
|
|
360
|
+
&:active:not(.is-disabled, .is-loading, :disabled) {
|
|
361
|
+
transition-duration: var(--ylf-duration-press, 100ms);
|
|
362
|
+
transform: scale(var(--ylf-press-scale, 0.98));
|
|
269
363
|
}
|
|
270
364
|
|
|
271
365
|
&.is-disabled,
|
|
@@ -281,6 +375,10 @@ function onClick(e: MouseEvent) {
|
|
|
281
375
|
}
|
|
282
376
|
|
|
283
377
|
&__label {
|
|
378
|
+
min-width: 0;
|
|
379
|
+
line-height: inherit;
|
|
380
|
+
box-sizing: border-box;
|
|
381
|
+
max-width: 100%;
|
|
284
382
|
display: inline-flex;
|
|
285
383
|
align-items: center;
|
|
286
384
|
}
|
|
@@ -301,13 +399,32 @@ function onClick(e: MouseEvent) {
|
|
|
301
399
|
}
|
|
302
400
|
}
|
|
303
401
|
|
|
402
|
+
@media (pointer: coarse) {
|
|
403
|
+
.ylf-button.is-icon-only {
|
|
404
|
+
min-width: 44px;
|
|
405
|
+
min-height: 44px;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
304
409
|
@media (prefers-reduced-motion: reduce) {
|
|
305
410
|
.ylf-button {
|
|
306
411
|
transition: none;
|
|
412
|
+
|
|
413
|
+
&:is(:hover, :active):not(.is-disabled, .is-loading, :disabled) {
|
|
414
|
+
transform: none;
|
|
415
|
+
transition: none;
|
|
416
|
+
}
|
|
307
417
|
}
|
|
308
418
|
|
|
309
419
|
.ylf-button__spinner {
|
|
310
|
-
animation
|
|
420
|
+
animation: none;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
@media (pointer: coarse) {
|
|
424
|
+
.ylf-button {
|
|
425
|
+
min-width: var(--ylf-touch-target, 44px);
|
|
426
|
+
min-height: max(var(--_min-height, 0px), var(--ylf-touch-target, 44px));
|
|
427
|
+
line-height: 1.4;
|
|
311
428
|
}
|
|
312
429
|
}
|
|
313
430
|
</style>
|
package/components/YlfCard.vue
CHANGED
|
@@ -43,13 +43,15 @@ withDefaults(defineProps<{
|
|
|
43
43
|
border: 1px solid var(--ylf-c-border, #e2e8f0);
|
|
44
44
|
box-shadow: var(--ylf-shadow-control, 0 2px 8px -2px rgba(15, 23, 42, 0.12));
|
|
45
45
|
transition:
|
|
46
|
-
transform var(--ylf-duration-
|
|
46
|
+
transform var(--ylf-duration-slow, 480ms) var(--ylf-ease-spring, var(--ylf-ease-standard, ease)),
|
|
47
47
|
box-shadow var(--ylf-duration-normal, 240ms) var(--ylf-ease-standard, ease),
|
|
48
48
|
background var(--ylf-duration-normal, 240ms) var(--ylf-ease-standard, ease);
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
@media (hover: hover) and (pointer: fine) {
|
|
51
|
+
&.is-hoverable:hover {
|
|
52
|
+
transform: translateY(-4px);
|
|
53
|
+
box-shadow: var(--ylf-shadow, 0 10px 28px -8px rgba(15, 23, 42, 0.16));
|
|
54
|
+
}
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
// 云玻璃
|
|
@@ -76,6 +78,10 @@ withDefaults(defineProps<{
|
|
|
76
78
|
@media (prefers-reduced-motion: reduce) {
|
|
77
79
|
.ylf-card {
|
|
78
80
|
transition: none;
|
|
81
|
+
|
|
82
|
+
&.is-hoverable:hover {
|
|
83
|
+
transform: none;
|
|
84
|
+
}
|
|
79
85
|
}
|
|
80
86
|
}
|
|
81
87
|
</style>
|