@yunlefun/vue 0.4.2 → 0.7.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/YlfScrollFade.vue +66 -0
- package/components/YlfSegmentedControl.vue +80 -10
- package/components/YlfSelect.vue +72 -34
- 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/components/scroll-fade/demo.vue +49 -0
- package/components/scroll-fade/index.md +40 -0
- package/components/scroll-fade.ts +52 -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/YlfScrollFade.vue.d.ts +24 -0
- 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/components/scroll-fade.d.ts +3 -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 +20 -6
package/components/YlfSelect.vue
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts" setup generic="T extends string = string">
|
|
2
2
|
import { SelectContent, SelectIcon, SelectItem, SelectItemIndicator, SelectItemText, SelectPortal, SelectRoot, SelectTrigger, SelectValue, SelectViewport } from 'reka-ui'
|
|
3
|
-
import { computed } from 'vue'
|
|
3
|
+
import { computed, useTemplateRef } from 'vue'
|
|
4
|
+
import YlfScrollFade from './YlfScrollFade.vue'
|
|
4
5
|
|
|
5
6
|
defineOptions({ inheritAttrs: false })
|
|
6
7
|
|
|
@@ -25,6 +26,7 @@ const props = withDefaults(defineProps<{
|
|
|
25
26
|
|
|
26
27
|
const model = defineModel<T>()
|
|
27
28
|
const selectedOption = computed(() => props.options.find(option => option.value === model.value))
|
|
29
|
+
const viewport = useTemplateRef<HTMLElement>('viewport')
|
|
28
30
|
</script>
|
|
29
31
|
|
|
30
32
|
<template>
|
|
@@ -43,28 +45,32 @@ const selectedOption = computed(() => props.options.find(option => option.value
|
|
|
43
45
|
</SelectIcon>
|
|
44
46
|
</SelectTrigger>
|
|
45
47
|
<SelectPortal :to="portalTo">
|
|
46
|
-
<SelectContent class="ylf-select__content" :data-size="size" position="popper" :side-offset="6">
|
|
47
|
-
<
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
48
|
+
<SelectContent class="ylf-select__content" :data-size="size" position="popper" :side-offset="6" :collision-padding="16">
|
|
49
|
+
<YlfScrollFade :viewport="viewport" surface="var(--ylf-c-panel, var(--ylf-c-surface, #fff))">
|
|
50
|
+
<SelectViewport as-child>
|
|
51
|
+
<div ref="viewport" class="ylf-select__viewport">
|
|
52
|
+
<SelectItem
|
|
53
|
+
v-for="o in options"
|
|
54
|
+
:key="o.value"
|
|
55
|
+
:value="o.value"
|
|
56
|
+
:disabled="o.disabled"
|
|
57
|
+
class="ylf-select__item"
|
|
58
|
+
>
|
|
59
|
+
<SelectItemText class="ylf-select__label">
|
|
60
|
+
<span v-if="o.color" class="ylf-select__swatch" :style="{ backgroundColor: o.color }" aria-hidden="true" />
|
|
61
|
+
<span>{{ o.label }}</span>
|
|
62
|
+
</SelectItemText>
|
|
63
|
+
<SelectItemIndicator class="ylf-select__check">
|
|
64
|
+
<slot name="indicator">
|
|
65
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
|
|
66
|
+
<path d="M5 12.5l4.5 4.5L19 7" />
|
|
67
|
+
</svg>
|
|
68
|
+
</slot>
|
|
69
|
+
</SelectItemIndicator>
|
|
70
|
+
</SelectItem>
|
|
71
|
+
</div>
|
|
72
|
+
</SelectViewport>
|
|
73
|
+
</YlfScrollFade>
|
|
68
74
|
</SelectContent>
|
|
69
75
|
</SelectPortal>
|
|
70
76
|
</SelectRoot>
|
|
@@ -76,7 +82,9 @@ const selectedOption = computed(() => props.options.find(option => option.value
|
|
|
76
82
|
align-items: center;
|
|
77
83
|
justify-content: space-between;
|
|
78
84
|
gap: 8px;
|
|
79
|
-
|
|
85
|
+
box-sizing: border-box;
|
|
86
|
+
max-width: 100%;
|
|
87
|
+
min-width: min(180px, 100%);
|
|
80
88
|
min-height: 44px;
|
|
81
89
|
padding: 10px 14px;
|
|
82
90
|
font-family: inherit;
|
|
@@ -89,15 +97,17 @@ const selectedOption = computed(() => props.options.find(option => option.value
|
|
|
89
97
|
box-shadow: var(--ylf-shadow-control);
|
|
90
98
|
cursor: pointer;
|
|
91
99
|
transition:
|
|
92
|
-
border-color
|
|
93
|
-
box-shadow
|
|
100
|
+
border-color var(--ylf-duration-fast, 160ms) var(--ylf-ease-standard, ease),
|
|
101
|
+
box-shadow var(--ylf-duration-fast, 160ms) var(--ylf-ease-standard, ease);
|
|
94
102
|
|
|
95
103
|
&[data-placeholder] {
|
|
96
104
|
color: var(--ylf-c-text-3, #64748b);
|
|
97
105
|
}
|
|
98
106
|
|
|
99
|
-
|
|
100
|
-
|
|
107
|
+
@media (hover: hover) and (pointer: fine) {
|
|
108
|
+
&:hover:not([data-disabled]) {
|
|
109
|
+
border-color: var(--ylf-c-brand, #2563eb);
|
|
110
|
+
}
|
|
101
111
|
}
|
|
102
112
|
|
|
103
113
|
&[data-state='open'] {
|
|
@@ -124,6 +134,7 @@ const selectedOption = computed(() => props.options.find(option => option.value
|
|
|
124
134
|
align-items: center;
|
|
125
135
|
gap: 8px;
|
|
126
136
|
min-width: 0;
|
|
137
|
+
overflow-wrap: anywhere;
|
|
127
138
|
}
|
|
128
139
|
|
|
129
140
|
.ylf-select__swatch {
|
|
@@ -166,12 +177,30 @@ const selectedOption = computed(() => props.options.find(option => option.value
|
|
|
166
177
|
transform-origin: var(--reka-select-content-transform-origin);
|
|
167
178
|
|
|
168
179
|
&[data-state='open'] {
|
|
169
|
-
animation: ylf-select-in
|
|
180
|
+
animation: ylf-select-in var(--ylf-duration-enter, 240ms) var(--ylf-ease-standard, ease);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
&[data-state='closed'] {
|
|
184
|
+
animation: ylf-select-out var(--ylf-duration-exit, 160ms) var(--ylf-ease-standard, ease);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
&[data-side='bottom'] {
|
|
188
|
+
--_enter-y: -4px;
|
|
189
|
+
}
|
|
190
|
+
&[data-side='top'] {
|
|
191
|
+
--_enter-y: 4px;
|
|
192
|
+
}
|
|
193
|
+
&[data-side='left'] {
|
|
194
|
+
--_enter-x: 4px;
|
|
195
|
+
}
|
|
196
|
+
&[data-side='right'] {
|
|
197
|
+
--_enter-x: -4px;
|
|
170
198
|
}
|
|
171
199
|
}
|
|
172
200
|
|
|
173
201
|
.ylf-select__viewport {
|
|
174
202
|
max-height: calc(var(--reka-select-content-available-height) - 14px);
|
|
203
|
+
scroll-padding-block: 24px;
|
|
175
204
|
}
|
|
176
205
|
|
|
177
206
|
.ylf-select__item {
|
|
@@ -225,24 +254,33 @@ const selectedOption = computed(() => props.options.find(option => option.value
|
|
|
225
254
|
}
|
|
226
255
|
|
|
227
256
|
@media (pointer: coarse) {
|
|
228
|
-
.ylf-select__trigger[data-size
|
|
229
|
-
.ylf-select__content[data-size
|
|
230
|
-
|
|
257
|
+
.ylf-select__trigger[data-size],
|
|
258
|
+
.ylf-select__content[data-size] .ylf-select__item {
|
|
259
|
+
box-sizing: border-box;
|
|
260
|
+
min-height: var(--ylf-touch-target, 44px);
|
|
231
261
|
}
|
|
232
262
|
}
|
|
233
263
|
|
|
234
264
|
@keyframes ylf-select-in {
|
|
235
265
|
from {
|
|
236
266
|
opacity: 0;
|
|
237
|
-
transform: scale(0.96);
|
|
267
|
+
transform: translate(var(--_enter-x, 0), var(--_enter-y, 0)) scale(0.96);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
@keyframes ylf-select-out {
|
|
272
|
+
to {
|
|
273
|
+
opacity: 0;
|
|
274
|
+
transform: scale(0.97);
|
|
238
275
|
}
|
|
239
276
|
}
|
|
240
277
|
|
|
241
278
|
@media (prefers-reduced-motion: reduce) {
|
|
242
|
-
.ylf-select__content[data-state
|
|
279
|
+
.ylf-select__content[data-state] {
|
|
243
280
|
animation: none;
|
|
244
281
|
}
|
|
245
282
|
|
|
283
|
+
.ylf-select__trigger,
|
|
246
284
|
.ylf-select__icon,
|
|
247
285
|
.ylf-select__item {
|
|
248
286
|
transition: none;
|
package/components/YlfSlider.vue
CHANGED
|
@@ -74,6 +74,7 @@ const model = defineModel<number[]>({ default: () => [50] })
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
&__thumb {
|
|
77
|
+
position: relative;
|
|
77
78
|
display: block;
|
|
78
79
|
width: 18px;
|
|
79
80
|
height: 18px;
|
|
@@ -82,10 +83,14 @@ const model = defineModel<number[]>({ default: () => [50] })
|
|
|
82
83
|
border: 2px solid var(--ylf-c-brand, #2563eb);
|
|
83
84
|
box-shadow: var(--ylf-shadow-sm, 0 2px 8px -2px rgba(15, 23, 42, 0.12));
|
|
84
85
|
cursor: grab;
|
|
85
|
-
transition:
|
|
86
|
+
transition:
|
|
87
|
+
box-shadow var(--ylf-duration-fast, 160ms) var(--ylf-ease-standard, ease),
|
|
88
|
+
scale var(--ylf-duration-slow, 480ms) var(--ylf-ease-spring, var(--ylf-ease-standard, ease));
|
|
86
89
|
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
@media (hover: hover) and (pointer: fine) {
|
|
91
|
+
&:hover {
|
|
92
|
+
box-shadow: 0 0 0 6px var(--ylf-c-brand-soft, #eff6ff);
|
|
93
|
+
}
|
|
89
94
|
}
|
|
90
95
|
|
|
91
96
|
&:focus-visible {
|
|
@@ -95,18 +100,24 @@ const model = defineModel<number[]>({ default: () => [50] })
|
|
|
95
100
|
|
|
96
101
|
&:active {
|
|
97
102
|
cursor: grabbing;
|
|
103
|
+
scale: 1.2;
|
|
104
|
+
box-shadow: 0 0 0 6px var(--ylf-c-brand-soft, #eff6ff);
|
|
98
105
|
}
|
|
99
106
|
}
|
|
100
107
|
}
|
|
101
108
|
|
|
102
109
|
@media (pointer: coarse) {
|
|
103
110
|
.ylf-slider {
|
|
104
|
-
height: 44px;
|
|
111
|
+
height: var(--ylf-touch-target, 44px);
|
|
105
112
|
}
|
|
106
113
|
|
|
107
114
|
.ylf-slider__thumb::before {
|
|
108
115
|
position: absolute;
|
|
109
|
-
|
|
116
|
+
top: 50%;
|
|
117
|
+
left: 50%;
|
|
118
|
+
width: max(100%, var(--ylf-touch-target, 44px));
|
|
119
|
+
height: max(100%, var(--ylf-touch-target, 44px));
|
|
120
|
+
transform: translate(-50%, -50%);
|
|
110
121
|
content: '';
|
|
111
122
|
}
|
|
112
123
|
}
|
package/components/YlfSwitch.vue
CHANGED
|
@@ -37,6 +37,8 @@ const checked = defineModel<boolean>({ default: false })
|
|
|
37
37
|
--_w: 52px;
|
|
38
38
|
--_h: 30px;
|
|
39
39
|
--_pad: 3px;
|
|
40
|
+
// 按下时拇指横向拉长,像被捏住的软糖;松开后弹回。
|
|
41
|
+
--_stretch: 0px;
|
|
40
42
|
|
|
41
43
|
position: relative;
|
|
42
44
|
flex: none;
|
|
@@ -83,9 +85,13 @@ const checked = defineModel<boolean>({ default: false })
|
|
|
83
85
|
background: var(--ylf-accent, var(--ylf-c-brand, #2563eb));
|
|
84
86
|
}
|
|
85
87
|
|
|
88
|
+
&:active:not([data-disabled]) {
|
|
89
|
+
--_stretch: 6px;
|
|
90
|
+
}
|
|
91
|
+
|
|
86
92
|
&__thumb {
|
|
87
93
|
display: block;
|
|
88
|
-
width: calc(var(--_h) - var(--_pad) * 2);
|
|
94
|
+
width: calc(var(--_h) - var(--_pad) * 2 + var(--_stretch));
|
|
89
95
|
height: calc(var(--_h) - var(--_pad) * 2);
|
|
90
96
|
border-radius: 50%;
|
|
91
97
|
background: #fff;
|
|
@@ -94,13 +100,14 @@ const checked = defineModel<boolean>({ default: false })
|
|
|
94
100
|
0 1px 2px rgba(0, 0, 0, 0.12),
|
|
95
101
|
0 3px 5px rgba(0, 0, 0, 0.18);
|
|
96
102
|
transform: translateX(var(--_pad));
|
|
97
|
-
transition:
|
|
98
|
-
|
|
103
|
+
transition:
|
|
104
|
+
transform var(--ylf-duration-slow, 480ms) var(--ylf-ease-spring, var(--ylf-ease-standard, ease)),
|
|
105
|
+
width var(--ylf-duration-normal, 240ms) var(--ylf-ease-spring, var(--ylf-ease-standard, ease));
|
|
99
106
|
}
|
|
100
107
|
|
|
101
108
|
&[data-state='checked'] &__thumb {
|
|
102
109
|
background: var(--ylf-c-text-on-accent, #fff);
|
|
103
|
-
transform: translateX(calc(var(--_w) - var(--_h) + var(--_pad)));
|
|
110
|
+
transform: translateX(calc(var(--_w) - var(--_h) + var(--_pad) - var(--_stretch)));
|
|
104
111
|
}
|
|
105
112
|
&--accent[data-state='checked'] &__thumb,
|
|
106
113
|
&--aurora[data-state='checked'] &__thumb {
|
|
@@ -114,4 +121,23 @@ const checked = defineModel<boolean>({ default: false })
|
|
|
114
121
|
transition: none;
|
|
115
122
|
}
|
|
116
123
|
}
|
|
124
|
+
@media (pointer: coarse) {
|
|
125
|
+
.ylf-switch {
|
|
126
|
+
position: relative;
|
|
127
|
+
box-sizing: border-box;
|
|
128
|
+
margin-block: max(0px, calc((var(--ylf-touch-target, 44px) - var(--_h)) / 2));
|
|
129
|
+
margin-inline: max(0px, calc((var(--ylf-touch-target, 44px) - var(--_w)) / 2));
|
|
130
|
+
touch-action: manipulation;
|
|
131
|
+
|
|
132
|
+
&::before {
|
|
133
|
+
position: absolute;
|
|
134
|
+
top: 50%;
|
|
135
|
+
left: 50%;
|
|
136
|
+
width: max(100%, var(--ylf-touch-target, 44px));
|
|
137
|
+
height: max(100%, var(--ylf-touch-target, 44px));
|
|
138
|
+
transform: translate(-50%, -50%);
|
|
139
|
+
content: '';
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
117
143
|
</style>
|
package/components/YlfTabs.vue
CHANGED
|
@@ -70,8 +70,10 @@ const model = defineModel<string>()
|
|
|
70
70
|
color var(--ylf-duration-fast, 160ms) ease,
|
|
71
71
|
background var(--ylf-duration-fast, 160ms) ease;
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
@media (hover: hover) and (pointer: fine) {
|
|
74
|
+
&:hover:not([data-disabled]) {
|
|
75
|
+
color: var(--ylf-c-text, #0f172a);
|
|
76
|
+
}
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
&[data-state='active'] {
|
|
@@ -103,8 +105,8 @@ const model = defineModel<string>()
|
|
|
103
105
|
box-shadow: 0 1px 4px color-mix(in srgb, var(--ylf-c-brand, #2563eb) 25%, transparent);
|
|
104
106
|
transform: translateX(var(--reka-tabs-indicator-position));
|
|
105
107
|
transition:
|
|
106
|
-
transform
|
|
107
|
-
width
|
|
108
|
+
transform var(--ylf-duration-slow, 480ms) var(--ylf-ease-spring, var(--ylf-ease-standard, ease)),
|
|
109
|
+
width var(--ylf-duration-normal, 240ms) var(--ylf-ease-standard, ease);
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
.ylf-tabs__content {
|
|
@@ -116,8 +118,14 @@ const model = defineModel<string>()
|
|
|
116
118
|
}
|
|
117
119
|
|
|
118
120
|
@media (prefers-reduced-motion: reduce) {
|
|
121
|
+
.ylf-tabs__trigger,
|
|
119
122
|
.ylf-tabs__indicator {
|
|
120
123
|
transition: none;
|
|
121
124
|
}
|
|
122
125
|
}
|
|
126
|
+
@media (pointer: coarse) {
|
|
127
|
+
.ylf-tabs__trigger {
|
|
128
|
+
min-height: var(--ylf-touch-target, 44px);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
123
131
|
</style>
|
|
@@ -49,8 +49,26 @@ withDefaults(defineProps<{
|
|
|
49
49
|
box-shadow: var(--ylf-shadow, 0 10px 28px -8px rgba(15, 23, 42, 0.16));
|
|
50
50
|
transform-origin: var(--reka-tooltip-content-transform-origin);
|
|
51
51
|
|
|
52
|
-
&[data-state='delayed-open']
|
|
53
|
-
|
|
52
|
+
&[data-state='delayed-open'],
|
|
53
|
+
&[data-state='instant-open'] {
|
|
54
|
+
animation: ylf-tooltip-in var(--ylf-duration-fast, 160ms) var(--ylf-ease-standard, ease);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&[data-state='closed'] {
|
|
58
|
+
animation: ylf-tooltip-out var(--ylf-duration-exit, 160ms) var(--ylf-ease-standard, ease);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&[data-side='bottom'] {
|
|
62
|
+
--_enter-y: -4px;
|
|
63
|
+
}
|
|
64
|
+
&[data-side='top'] {
|
|
65
|
+
--_enter-y: 4px;
|
|
66
|
+
}
|
|
67
|
+
&[data-side='left'] {
|
|
68
|
+
--_enter-x: 4px;
|
|
69
|
+
}
|
|
70
|
+
&[data-side='right'] {
|
|
71
|
+
--_enter-x: -4px;
|
|
54
72
|
}
|
|
55
73
|
|
|
56
74
|
&__arrow {
|
|
@@ -61,12 +79,19 @@ withDefaults(defineProps<{
|
|
|
61
79
|
@keyframes ylf-tooltip-in {
|
|
62
80
|
from {
|
|
63
81
|
opacity: 0;
|
|
64
|
-
transform: scale(0.94);
|
|
82
|
+
transform: translate(var(--_enter-x, 0), var(--_enter-y, 0)) scale(0.94);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@keyframes ylf-tooltip-out {
|
|
87
|
+
to {
|
|
88
|
+
opacity: 0;
|
|
89
|
+
transform: scale(0.97);
|
|
65
90
|
}
|
|
66
91
|
}
|
|
67
92
|
|
|
68
93
|
@media (prefers-reduced-motion: reduce) {
|
|
69
|
-
.ylf-tooltip[data-state
|
|
94
|
+
.ylf-tooltip[data-state] {
|
|
70
95
|
animation: none;
|
|
71
96
|
}
|
|
72
97
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Shared treatment for route links and navigation menu triggers.
|
|
2
|
+
@mixin control {
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
min-height: 44px;
|
|
7
|
+
gap: var(--ylf-space-2, 8px);
|
|
8
|
+
border: 1px solid transparent;
|
|
9
|
+
border-radius: var(--ylf-radius-sm, 10px);
|
|
10
|
+
background: transparent;
|
|
11
|
+
color: var(--ylf-c-text-2, #475569);
|
|
12
|
+
font-family: var(--ylf-font-body, inherit);
|
|
13
|
+
font-size: var(--ylf-text-sm, 0.875rem);
|
|
14
|
+
font-weight: 500;
|
|
15
|
+
line-height: 1.25rem;
|
|
16
|
+
text-decoration: none;
|
|
17
|
+
white-space: nowrap;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
transition:
|
|
20
|
+
background-color var(--ylf-duration-fast, 160ms) var(--ylf-ease-standard, ease),
|
|
21
|
+
color var(--ylf-duration-fast, 160ms) var(--ylf-ease-standard, ease);
|
|
22
|
+
|
|
23
|
+
&:hover:not(:disabled) {
|
|
24
|
+
background: var(--ylf-c-bg-soft, #f1f5f9);
|
|
25
|
+
color: var(--ylf-c-text, #0f172a);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Focus stays inside the target so it cannot overlap a neighboring state.
|
|
29
|
+
&:focus-visible {
|
|
30
|
+
outline: 2px solid var(--ylf-c-brand, #2563eb);
|
|
31
|
+
outline-offset: -2px;
|
|
32
|
+
box-shadow: none;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@media (prefers-reduced-motion: reduce) {
|
|
36
|
+
transition: none;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
const items = [
|
|
3
|
-
{ value: 'a', title: '
|
|
3
|
+
{ value: 'a', title: '什么是云乐坊设计系统?', content: '云乐坊设计系统,统一设计规范、品牌视觉与 UI 实现;默认晴空蓝为主,高饱和纯色点缀。' },
|
|
4
4
|
{ value: 'b', title: '为什么基于 reka-ui?', content: 'Reka UI 提供键盘、焦点和 ARIA 行为,云乐坊提供产品接口与主题;封装后的场景仍需逐项验收。' },
|
|
5
5
|
{ value: 'c', title: '支持暗色吗?', content: '晴空白与深蓝夜空两套中性色,token 驱动,零配置随主题切换。' },
|
|
6
6
|
]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { shallowRef } from 'vue'
|
|
3
|
+
|
|
4
|
+
const continued = shallowRef(false)
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<YlfAgentCard name="el-bot" description="本机 AI 助手" state="ready" status-label="已就绪">
|
|
9
|
+
<YlfAgentTask title="当前任务" :state="continued ? 'working' : 'waiting'" :status-label="continued ? '执行中' : '等待审批'" task-id="task-20261006-001" description="查看操作范围后,由应用显式确认是否继续。">
|
|
10
|
+
<template #actions>
|
|
11
|
+
<YlfButton :disabled="continued" @click="continued = true">
|
|
12
|
+
继续
|
|
13
|
+
</YlfButton>
|
|
14
|
+
</template>
|
|
15
|
+
</YlfAgentTask>
|
|
16
|
+
</YlfAgentCard>
|
|
17
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Agent Card
|
|
3
|
+
title_zh: 机器人概览
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
机器人控制台的概览容器:身份、说明、状态、连接信息与操作入口。表面、字体与间距读取共享 token;信息卡片保持静止,不使用悬停上浮暗示可点击。
|
|
7
|
+
|
|
8
|
+
## Props
|
|
9
|
+
|
|
10
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
11
|
+
| ------------- | ------------------------------ | --------------- | ------ |
|
|
12
|
+
| `name` | 机器人名称,作为区域可访问名称 | `string` | 必填 |
|
|
13
|
+
| `description` | 机器人用途或当前项目 | `string` | — |
|
|
14
|
+
| `state` | 展示状态 | `YlfAgentState` | 必填 |
|
|
15
|
+
| `statusLabel` | 本地化的状态文字 | `string` | 必填 |
|
|
16
|
+
|
|
17
|
+
## Slots
|
|
18
|
+
|
|
19
|
+
| 名称 | 说明 |
|
|
20
|
+
| --------- | ---------------------------------------- |
|
|
21
|
+
| `avatar` | 可替换的机器人形象;默认图形仅作装饰 |
|
|
22
|
+
| `default` | 连接信息等业务内容 |
|
|
23
|
+
| `actions` | 操作按钮;权限、禁用条件与事件由应用控制 |
|
|
24
|
+
|
|
25
|
+
组件不接收凭据、不建立连接、不保存审批,也不执行任何操作。名称与说明使用转义文本展示。接入方式见[机器人组件](/guide/agent-ui)。
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const states = [
|
|
3
|
+
{
|
|
4
|
+
state: 'offline',
|
|
5
|
+
label: '未连接',
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
state: 'connecting',
|
|
9
|
+
label: '连接中',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
state: 'ready',
|
|
13
|
+
label: '已就绪',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
state: 'working',
|
|
17
|
+
label: '执行中',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
state: 'waiting',
|
|
21
|
+
label: '等待审批',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
state: 'error',
|
|
25
|
+
label: '连接失败',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
state: 'unknown',
|
|
29
|
+
label: '未验证',
|
|
30
|
+
},
|
|
31
|
+
] as const
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<div style="display: flex; flex-wrap: wrap; gap: var(--ylf-space-3)">
|
|
36
|
+
<YlfAgentStatus v-for="item in states" :key="item.state" :state="item.state" :label="item.label" />
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Agent Status
|
|
3
|
+
title_zh: 机器人状态
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
使用语义色、图形和明确文字表达机器人连接与任务状态。状态来自调用方,组件不会根据颜色推测连接成功,也不播放持续动画。
|
|
7
|
+
|
|
8
|
+
`state` 是展示角色:`offline` 离线、`connecting` 连接中、`ready` 就绪或成功、`working` 执行中、`waiting` 等待人工操作、`error` 失败、`unknown` 未验证。必须同时提供本地化的 `label`。HTTP 回调正在监听时可使用 `waiting` 与“回调已监听”,不要标记为“已连接”。
|
|
9
|
+
|
|
10
|
+
## Props
|
|
11
|
+
|
|
12
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
13
|
+
| ------- | ---------------------- | --------------- | ------- |
|
|
14
|
+
| `state` | 展示状态 | `YlfAgentState` | 必填 |
|
|
15
|
+
| `label` | 本地化的真实状态文字 | `string` | 必填 |
|
|
16
|
+
| `live` | 为单个摘要开启礼貌播报 | `boolean` | `false` |
|
|
17
|
+
|
|
18
|
+
默认不创建 live region,避免轮询列表反复播报。需要播报时,只为一个摘要设置 `live`。
|
|
19
|
+
|
|
20
|
+
源码及 Registry 尚待发布。接入方式见[机器人组件](/guide/agent-ui)。
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { shallowRef } from 'vue'
|
|
3
|
+
|
|
4
|
+
const continued = shallowRef(false)
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<YlfAgentTask title="当前任务" :state="continued ? 'working' : 'waiting'" :status-label="continued ? '执行中' : '等待审批'" task-id="task-20261006-001" description="查看操作范围后,由应用显式确认是否继续。">
|
|
9
|
+
<template #actions>
|
|
10
|
+
<YlfButton :disabled="continued" @click="continued = true">
|
|
11
|
+
继续
|
|
12
|
+
</YlfButton>
|
|
13
|
+
</template>
|
|
14
|
+
</YlfAgentTask>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Agent Task
|
|
3
|
+
title_zh: 机器人任务
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
展示当前任务、执行状态、任务标识与等待原因。可以用于执行中、等待审批、完成、失败或空闲场景。没有可靠进度时不显示百分比,也不会将忙碌状态解释为完成。
|
|
7
|
+
|
|
8
|
+
## Props
|
|
9
|
+
|
|
10
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
11
|
+
| ------------- | -------------------------------- | --------------- | ------ |
|
|
12
|
+
| `title` | 区域标题 | `string` | 必填 |
|
|
13
|
+
| `state` | 展示状态 | `YlfAgentState` | 必填 |
|
|
14
|
+
| `statusLabel` | 本地化的真实任务状态 | `string` | 必填 |
|
|
15
|
+
| `taskId` | 可选任务标识,等宽字体并允许换行 | `string` | — |
|
|
16
|
+
| `description` | 当前状态或等待原因 | `string` | — |
|
|
17
|
+
|
|
18
|
+
## Slots
|
|
19
|
+
|
|
20
|
+
| 名称 | 说明 |
|
|
21
|
+
| --------- | -------------------------------------------- |
|
|
22
|
+
| `default` | 任务补充信息 |
|
|
23
|
+
| `actions` | 应用控制的操作,例如查看详情、请求中断或审批 |
|
|
24
|
+
|
|
25
|
+
审批与中断必须由应用显式处理;卡片没有默认操作,不会把关闭卡片当成批准。实际模型状态未知时使用 `unknown` 并显示后端状态文字。接入方式见[机器人组件](/guide/agent-ui)。
|
|
@@ -10,6 +10,27 @@ function fakeLoad() {
|
|
|
10
10
|
|
|
11
11
|
<template>
|
|
12
12
|
<div class="flex flex-col gap-5">
|
|
13
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
14
|
+
<YlfTooltip content="查看源码">
|
|
15
|
+
<YlfButton icon-only :round="false" variant="ghost" aria-label="查看源码">
|
|
16
|
+
<span class="i-ri-code-s-slash-line" aria-hidden="true" />
|
|
17
|
+
</YlfButton>
|
|
18
|
+
</YlfTooltip>
|
|
19
|
+
<YlfButton icon-only variant="secondary" aria-label="添加项目">
|
|
20
|
+
<span class="i-ri-add-line" aria-hidden="true" />
|
|
21
|
+
</YlfButton>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
24
|
+
<YlfButton variant="hero" size="xl">
|
|
25
|
+
浏览应用 →
|
|
26
|
+
</YlfButton>
|
|
27
|
+
<YlfButton variant="hero" size="xl" loading>
|
|
28
|
+
正在打开
|
|
29
|
+
</YlfButton>
|
|
30
|
+
<YlfButton variant="hero" size="xl" disabled>
|
|
31
|
+
暂不可用
|
|
32
|
+
</YlfButton>
|
|
33
|
+
</div>
|
|
13
34
|
<div class="flex flex-wrap items-center gap-3">
|
|
14
35
|
<YlfButton variant="primary">
|
|
15
36
|
晴空蓝 Primary
|