@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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
// 行为 / 可访问性由 reka-ui 提供(role=checkbox、键盘、三态 indeterminate);皮肤走 token。
|
|
3
3
|
import { CheckboxIndicator, CheckboxRoot } from 'reka-ui'
|
|
4
|
+
import { shallowRef, watch } from 'vue'
|
|
4
5
|
|
|
5
6
|
withDefaults(defineProps<{
|
|
6
7
|
disabled?: boolean
|
|
@@ -11,6 +12,11 @@ withDefaults(defineProps<{
|
|
|
11
12
|
})
|
|
12
13
|
|
|
13
14
|
const checked = defineModel<boolean | 'indeterminate'>({ default: false })
|
|
15
|
+
// 只在状态真正变化后播放勾选动效,首屏已选中的项保持静止。
|
|
16
|
+
const animated = shallowRef(false)
|
|
17
|
+
watch(checked, () => {
|
|
18
|
+
animated.value = true
|
|
19
|
+
})
|
|
14
20
|
</script>
|
|
15
21
|
|
|
16
22
|
<template>
|
|
@@ -19,13 +25,14 @@ const checked = defineModel<boolean | 'indeterminate'>({ default: false })
|
|
|
19
25
|
:disabled="disabled"
|
|
20
26
|
:value="value"
|
|
21
27
|
class="ylf-checkbox"
|
|
28
|
+
:class="{ 'is-animated': animated }"
|
|
22
29
|
>
|
|
23
30
|
<CheckboxIndicator class="ylf-checkbox__indicator">
|
|
24
31
|
<svg v-if="checked === 'indeterminate'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round">
|
|
25
|
-
<path d="M5 12h14" />
|
|
32
|
+
<path d="M5 12h14" pathLength="1" />
|
|
26
33
|
</svg>
|
|
27
34
|
<svg v-else viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
|
|
28
|
-
<path d="M5 12.5l4.5 4.5L19 7" />
|
|
35
|
+
<path d="M5 12.5l4.5 4.5L19 7" pathLength="1" />
|
|
29
36
|
</svg>
|
|
30
37
|
</CheckboxIndicator>
|
|
31
38
|
</CheckboxRoot>
|
|
@@ -49,12 +56,15 @@ const checked = defineModel<boolean | 'indeterminate'>({ default: false })
|
|
|
49
56
|
cursor: pointer;
|
|
50
57
|
-webkit-tap-highlight-color: transparent;
|
|
51
58
|
transition:
|
|
52
|
-
background
|
|
53
|
-
border-color
|
|
54
|
-
box-shadow
|
|
59
|
+
background var(--ylf-duration-fast, 160ms) var(--ylf-ease-standard, ease),
|
|
60
|
+
border-color var(--ylf-duration-fast, 160ms) var(--ylf-ease-standard, ease),
|
|
61
|
+
box-shadow var(--ylf-duration-fast, 160ms) var(--ylf-ease-standard, ease),
|
|
62
|
+
transform var(--ylf-duration-slow, 480ms) var(--ylf-ease-spring, var(--ylf-ease-standard, ease));
|
|
55
63
|
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
@media (hover: hover) and (pointer: fine) {
|
|
65
|
+
&:hover:not([data-disabled]) {
|
|
66
|
+
border-color: var(--ylf-c-brand, #2563eb);
|
|
67
|
+
}
|
|
58
68
|
}
|
|
59
69
|
|
|
60
70
|
&:focus-visible {
|
|
@@ -63,6 +73,16 @@ const checked = defineModel<boolean | 'indeterminate'>({ default: false })
|
|
|
63
73
|
box-shadow: 0 0 0 3px var(--ylf-c-brand-soft, #eff6ff);
|
|
64
74
|
}
|
|
65
75
|
|
|
76
|
+
&:active:not([data-disabled]) {
|
|
77
|
+
transform: scale(0.9);
|
|
78
|
+
transition-duration: var(--ylf-duration-press, 100ms);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&.is-animated[data-state='checked'],
|
|
82
|
+
&.is-animated[data-state='indeterminate'] {
|
|
83
|
+
animation: ylf-checkbox-pop var(--ylf-duration-slow, 480ms) var(--ylf-ease-spring, var(--ylf-ease-standard, ease));
|
|
84
|
+
}
|
|
85
|
+
|
|
66
86
|
&[data-state='checked'],
|
|
67
87
|
&[data-state='indeterminate'] {
|
|
68
88
|
background: var(--ylf-c-brand, #2563eb);
|
|
@@ -83,5 +103,48 @@ const checked = defineModel<boolean | 'indeterminate'>({ default: false })
|
|
|
83
103
|
width: 14px;
|
|
84
104
|
height: 14px;
|
|
85
105
|
}
|
|
106
|
+
|
|
107
|
+
// 对勾按笔画顺序画出。
|
|
108
|
+
&.is-animated &__indicator path {
|
|
109
|
+
stroke-dasharray: 1;
|
|
110
|
+
animation: ylf-checkbox-draw var(--ylf-duration-normal, 240ms) var(--ylf-ease-standard, ease) 60ms backwards;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
@media (pointer: coarse) {
|
|
114
|
+
.ylf-checkbox {
|
|
115
|
+
position: relative;
|
|
116
|
+
box-sizing: border-box;
|
|
117
|
+
margin-block: max(0px, calc((var(--ylf-touch-target, 44px) - var(--_size)) / 2));
|
|
118
|
+
margin-inline: max(0px, calc((var(--ylf-touch-target, 44px) - var(--_size)) / 2));
|
|
119
|
+
touch-action: manipulation;
|
|
120
|
+
|
|
121
|
+
&::before {
|
|
122
|
+
position: absolute;
|
|
123
|
+
top: 50%;
|
|
124
|
+
left: 50%;
|
|
125
|
+
width: max(100%, var(--ylf-touch-target, 44px));
|
|
126
|
+
height: max(100%, var(--ylf-touch-target, 44px));
|
|
127
|
+
transform: translate(-50%, -50%);
|
|
128
|
+
content: '';
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
@keyframes ylf-checkbox-pop {
|
|
133
|
+
from {
|
|
134
|
+
transform: scale(0.82);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
@keyframes ylf-checkbox-draw {
|
|
138
|
+
from {
|
|
139
|
+
stroke-dashoffset: 1;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
@media (prefers-reduced-motion: reduce) {
|
|
143
|
+
.ylf-checkbox,
|
|
144
|
+
.ylf-checkbox.is-animated[data-state],
|
|
145
|
+
.ylf-checkbox.is-animated .ylf-checkbox__indicator path {
|
|
146
|
+
transition: none;
|
|
147
|
+
animation: none;
|
|
148
|
+
}
|
|
86
149
|
}
|
|
87
150
|
</style>
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { YlfCloudShape } from './cloud'
|
|
3
|
+
import { computed, useId } from 'vue'
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(defineProps<{
|
|
6
|
+
shape?: YlfCloudShape
|
|
7
|
+
/** 用模糊滤镜塑造亮面体积;只给少数视觉焦点开启,其余用渐变近似以降低绘制开销。 */
|
|
8
|
+
volumetric?: boolean
|
|
9
|
+
/** 渲染一张平时隐藏的小脸,由 --ylf-cloud-face-opacity 唤醒。 */
|
|
10
|
+
face?: boolean
|
|
11
|
+
}>(), {
|
|
12
|
+
shape: 'billow',
|
|
13
|
+
volumetric: false,
|
|
14
|
+
face: false,
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const id = `ylf-cloud-${useId()}`
|
|
18
|
+
|
|
19
|
+
// 连续轮廓让云边保持柔软,不露出圆形拼接;每种轮廓都不同,缩放、翻转后也不会显得重复。
|
|
20
|
+
const silhouettes: Record<YlfCloudShape, string> = {
|
|
21
|
+
// 层层鼓起的主云。
|
|
22
|
+
billow: 'M 58 199 C 26 199 8 185 8 164 C 8 144 22 130 43 128 C 39 102 55 81 79 80 C 94 79 106 85 115 94 C 106 57 129 24 164 23 C 191 22 211 38 220 61 C 232 43 251 36 269 40 C 295 45 310 66 309 90 C 325 80 345 83 357 95 C 367 104 371 117 369 129 C 392 119 417 130 424 151 C 449 147 477 163 477 183 C 477 207 453 218 422 218 C 391 218 367 213 341 216 C 303 222 272 218 246 215 C 211 222 176 217 151 212 C 118 218 84 214 58 199 Z',
|
|
23
|
+
// 宽厚的近景积云,右侧堆得更高。
|
|
24
|
+
heap: 'M 40 205 C 14 205 4 190 10 174 C 16 158 34 152 52 156 C 50 126 74 106 102 112 C 112 78 150 62 182 76 C 198 44 240 30 274 46 C 302 30 344 38 360 66 C 392 58 424 78 426 108 C 456 110 482 132 480 162 C 486 190 466 208 436 210 C 380 214 330 212 280 214 C 220 216 160 214 110 212 C 84 212 60 208 40 205 Z',
|
|
25
|
+
// 贴着地平线的扁长云堤。
|
|
26
|
+
bank: 'M 30 212 C 10 212 2 200 8 188 C 14 176 30 172 46 176 C 52 156 74 148 94 156 C 108 136 138 132 156 146 C 172 124 208 120 228 138 C 246 118 284 118 300 140 C 318 126 352 128 362 150 C 380 140 410 144 418 162 C 444 158 470 172 474 190 C 478 206 462 214 440 214 C 380 216 300 214 230 216 C 160 218 90 214 30 212 Z',
|
|
27
|
+
// 圆鼓鼓的小团云。
|
|
28
|
+
puff: 'M 120 210 C 88 210 70 192 76 170 C 82 150 102 142 122 148 C 120 112 150 86 186 90 C 204 60 250 52 278 76 C 300 64 336 74 344 104 C 376 102 404 126 400 156 C 412 182 396 210 366 212 C 300 214 220 214 120 210 Z',
|
|
29
|
+
// 远处拉长的薄云。
|
|
30
|
+
wisp: 'M 20 200 C 6 200 2 190 10 184 C 18 178 30 178 40 180 C 52 166 80 162 98 170 C 120 156 160 154 182 166 C 206 152 248 150 270 164 C 296 152 336 154 352 168 C 376 160 410 162 426 174 C 452 170 482 178 484 190 C 486 202 470 206 446 206 C 380 208 300 206 230 208 C 160 210 80 206 20 200 Z',
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const d = computed(() => silhouettes[props.shape] ?? silhouettes.billow)
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<svg
|
|
38
|
+
class="ylf-cloud"
|
|
39
|
+
:data-shape="shape"
|
|
40
|
+
viewBox="0 0 490 250"
|
|
41
|
+
fill="none"
|
|
42
|
+
focusable="false"
|
|
43
|
+
aria-hidden="true"
|
|
44
|
+
>
|
|
45
|
+
<defs>
|
|
46
|
+
<!-- 光从左上方来:亮面 → 云体 → 背光面。 -->
|
|
47
|
+
<linearGradient :id="`${id}-body`" x1="210" y1="35" x2="246" y2="222" gradientUnits="userSpaceOnUse">
|
|
48
|
+
<stop stop-color="var(--_ylf-cloud-highlight)" />
|
|
49
|
+
<stop offset="0.46" stop-color="var(--_ylf-cloud-body)" />
|
|
50
|
+
<stop offset="1" stop-color="var(--_ylf-cloud-shade)" />
|
|
51
|
+
</linearGradient>
|
|
52
|
+
<radialGradient :id="`${id}-light`" cx="0.3" cy="0.2" r="0.8">
|
|
53
|
+
<stop stop-color="var(--_ylf-cloud-highlight)" stop-opacity="0.9" />
|
|
54
|
+
<stop offset="1" stop-color="var(--_ylf-cloud-highlight)" stop-opacity="0" />
|
|
55
|
+
</radialGradient>
|
|
56
|
+
<radialGradient :id="`${id}-shade`" cx="0.5" cy="0.9" r="0.65">
|
|
57
|
+
<stop stop-color="var(--_ylf-cloud-shadow)" stop-opacity="0.34" />
|
|
58
|
+
<stop offset="1" stop-color="var(--_ylf-cloud-shadow)" stop-opacity="0" />
|
|
59
|
+
</radialGradient>
|
|
60
|
+
<!-- 顶部逆光描边:亮面沿轮廓收成一道细光,向下逐渐消失。 -->
|
|
61
|
+
<linearGradient :id="`${id}-rim`" x1="0" y1="30" x2="0" y2="170" gradientUnits="userSpaceOnUse">
|
|
62
|
+
<stop stop-color="var(--ylf-cloud-rim, #ffffff)" stop-opacity="0.95" />
|
|
63
|
+
<stop offset="0.55" stop-color="var(--ylf-cloud-rim, #ffffff)" stop-opacity="0.25" />
|
|
64
|
+
<stop offset="1" stop-color="var(--ylf-cloud-rim, #ffffff)" stop-opacity="0" />
|
|
65
|
+
</linearGradient>
|
|
66
|
+
<clipPath :id="`${id}-clip`">
|
|
67
|
+
<path :d="d" />
|
|
68
|
+
</clipPath>
|
|
69
|
+
<filter
|
|
70
|
+
v-if="volumetric"
|
|
71
|
+
:id="`${id}-soften`"
|
|
72
|
+
x="-20%"
|
|
73
|
+
y="-20%"
|
|
74
|
+
width="140%"
|
|
75
|
+
height="140%"
|
|
76
|
+
color-interpolation-filters="sRGB"
|
|
77
|
+
>
|
|
78
|
+
<feGaussianBlur stdDeviation="7" />
|
|
79
|
+
</filter>
|
|
80
|
+
</defs>
|
|
81
|
+
|
|
82
|
+
<g :clip-path="`url(#${id}-clip)`">
|
|
83
|
+
<path :d="d" :fill="`url(#${id}-body)`" />
|
|
84
|
+
<ellipse class="ylf-cloud__underside" cx="240" cy="181" rx="218" ry="61" :fill="`url(#${id}-shade)`" />
|
|
85
|
+
<g v-if="volumetric" class="ylf-cloud__volume" :filter="`url(#${id}-soften)`">
|
|
86
|
+
<path d="M 63 172 C 84 149 108 164 121 141 C 133 122 119 107 124 83 C 131 40 177 25 204 53 C 229 79 201 113 223 130 C 247 149 277 139 291 162 C 307 188 268 208 218 209 L 80 203 Z" :fill="`url(#${id}-light)`" />
|
|
87
|
+
<path d="M 230 174 C 255 163 261 152 257 131 C 252 101 273 83 296 93 C 311 100 312 119 325 128 C 341 138 367 133 374 154 C 383 181 350 199 313 201 L 228 207 Z" :fill="`url(#${id}-light)`" opacity="0.56" />
|
|
88
|
+
</g>
|
|
89
|
+
<g v-else class="ylf-cloud__volume">
|
|
90
|
+
<ellipse cx="190" cy="96" rx="190" ry="86" :fill="`url(#${id}-light)`" />
|
|
91
|
+
<ellipse cx="350" cy="128" rx="110" ry="58" :fill="`url(#${id}-light)`" opacity="0.5" />
|
|
92
|
+
</g>
|
|
93
|
+
<path :d="d" class="ylf-cloud__rim" :stroke="`url(#${id}-rim)`" stroke-width="7" />
|
|
94
|
+
</g>
|
|
95
|
+
|
|
96
|
+
<!-- 若隐若现的小脸:宿主在悬停、聚焦或被戳时调高 --ylf-cloud-face-opacity。 -->
|
|
97
|
+
<g v-if="face" class="ylf-cloud__face">
|
|
98
|
+
<ellipse class="ylf-cloud__eye" cx="214" cy="150" rx="6" ry="8" />
|
|
99
|
+
<ellipse class="ylf-cloud__eye" cx="268" cy="150" rx="6" ry="8" />
|
|
100
|
+
<path d="M 230 166 Q 241 176 252 166" stroke-width="5" stroke-linecap="round" />
|
|
101
|
+
<ellipse cx="196" cy="168" rx="11" ry="6" class="ylf-cloud__blush" />
|
|
102
|
+
<ellipse cx="286" cy="168" rx="11" ry="6" class="ylf-cloud__blush" />
|
|
103
|
+
</g>
|
|
104
|
+
</svg>
|
|
105
|
+
</template>
|
|
106
|
+
|
|
107
|
+
<style lang="scss">
|
|
108
|
+
// 配色来自 @yunlefun/ui 的 --ylf-cloud-* token,随主题切换;
|
|
109
|
+
// --ylf-cloud-haze(0–1)把远处的云混向天空色,形成空气透视。
|
|
110
|
+
.ylf-cloud {
|
|
111
|
+
--_ylf-cloud-haze-color: var(--ylf-cloud-haze-color, #9cc6ef);
|
|
112
|
+
--_ylf-cloud-highlight: color-mix(
|
|
113
|
+
in srgb,
|
|
114
|
+
var(--ylf-cloud-highlight, #fffefa),
|
|
115
|
+
var(--_ylf-cloud-haze-color) calc(var(--ylf-cloud-haze, 0) * 70%)
|
|
116
|
+
);
|
|
117
|
+
--_ylf-cloud-body: color-mix(
|
|
118
|
+
in srgb,
|
|
119
|
+
var(--ylf-cloud-body, #f2f8ff),
|
|
120
|
+
var(--_ylf-cloud-haze-color) calc(var(--ylf-cloud-haze, 0) * 85%)
|
|
121
|
+
);
|
|
122
|
+
--_ylf-cloud-shade: color-mix(
|
|
123
|
+
in srgb,
|
|
124
|
+
var(--ylf-cloud-shade, #c6dff5),
|
|
125
|
+
var(--_ylf-cloud-haze-color) calc(var(--ylf-cloud-haze, 0) * 100%)
|
|
126
|
+
);
|
|
127
|
+
--_ylf-cloud-shadow: color-mix(
|
|
128
|
+
in srgb,
|
|
129
|
+
var(--ylf-cloud-shadow, #83addb),
|
|
130
|
+
var(--_ylf-cloud-haze-color) calc(var(--ylf-cloud-haze, 0) * 100%)
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
display: block;
|
|
134
|
+
width: 100%;
|
|
135
|
+
height: auto;
|
|
136
|
+
overflow: visible;
|
|
137
|
+
pointer-events: none;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.ylf-cloud__underside {
|
|
141
|
+
opacity: calc(1 - var(--ylf-cloud-haze, 0) * 0.8);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.ylf-cloud__rim {
|
|
145
|
+
fill: none;
|
|
146
|
+
opacity: calc(0.85 - var(--ylf-cloud-haze, 0) * 0.6);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.ylf-cloud__face {
|
|
150
|
+
opacity: var(--ylf-cloud-face-opacity, 0);
|
|
151
|
+
fill: var(--ylf-cloud-face, #5a7fae);
|
|
152
|
+
stroke: var(--ylf-cloud-face, #5a7fae);
|
|
153
|
+
transition: opacity var(--ylf-duration-slow, 480ms) var(--ylf-ease-standard, cubic-bezier(0.2, 0, 0, 1));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.ylf-cloud__face path {
|
|
157
|
+
fill: none;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.ylf-cloud__blush {
|
|
161
|
+
fill: var(--ylf-palette-pink, #ec4899);
|
|
162
|
+
stroke: none;
|
|
163
|
+
opacity: 0.28;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.ylf-cloud__eye {
|
|
167
|
+
transform-box: fill-box;
|
|
168
|
+
transform-origin: center;
|
|
169
|
+
animation: ylf-cloud-blink 5.2s ease-in-out 3s infinite;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@keyframes ylf-cloud-blink {
|
|
173
|
+
0%,
|
|
174
|
+
92%,
|
|
175
|
+
100% {
|
|
176
|
+
transform: scaleY(1);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
95% {
|
|
180
|
+
transform: scaleY(0.1);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
@media (prefers-reduced-motion: reduce) {
|
|
185
|
+
.ylf-cloud__face {
|
|
186
|
+
transition: none;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.ylf-cloud__eye {
|
|
190
|
+
animation: none;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
</style>
|
package/components/YlfDialog.vue
CHANGED
|
@@ -85,19 +85,32 @@ const descriptionProps = computed(() => hasDescription.value
|
|
|
85
85
|
-webkit-backdrop-filter: var(--ylf-overlay-blur, blur(10px));
|
|
86
86
|
backdrop-filter: var(--ylf-overlay-blur, blur(10px));
|
|
87
87
|
|
|
88
|
+
&[data-state='closed'] {
|
|
89
|
+
animation: ylf-dialog-overlay-out var(--ylf-duration-exit, 160ms) var(--ylf-ease-standard, ease);
|
|
90
|
+
}
|
|
91
|
+
|
|
88
92
|
&[data-state='open'] {
|
|
89
|
-
animation: ylf-dialog-overlay-in var(--ylf-duration-
|
|
93
|
+
animation: ylf-dialog-overlay-in var(--ylf-duration-enter, 240ms) ease;
|
|
90
94
|
}
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
.ylf-dialog__content {
|
|
98
|
+
--_inset-top: max(var(--ylf-viewport-gutter, 16px), env(safe-area-inset-top, 0px));
|
|
99
|
+
--_inset-right: max(var(--ylf-viewport-gutter, 16px), env(safe-area-inset-right, 0px));
|
|
100
|
+
--_inset-bottom: max(var(--ylf-viewport-gutter, 16px), env(safe-area-inset-bottom, 0px));
|
|
101
|
+
--_inset-left: max(var(--ylf-viewport-gutter, 16px), env(safe-area-inset-left, 0px));
|
|
102
|
+
|
|
94
103
|
position: fixed;
|
|
95
104
|
z-index: 101;
|
|
96
105
|
top: 50%;
|
|
97
|
-
|
|
98
|
-
|
|
106
|
+
top: calc((100dvh + var(--_inset-top) - var(--_inset-bottom)) / 2);
|
|
107
|
+
left: calc((100% + var(--_inset-left) - var(--_inset-right)) / 2);
|
|
108
|
+
box-sizing: border-box;
|
|
109
|
+
width: calc(100% - var(--_inset-left) - var(--_inset-right));
|
|
99
110
|
max-width: 480px;
|
|
100
111
|
max-height: calc(100vh - 32px);
|
|
112
|
+
max-height: calc(100dvh - var(--_inset-top) - var(--_inset-bottom));
|
|
113
|
+
overscroll-behavior: contain;
|
|
101
114
|
overflow: auto;
|
|
102
115
|
padding: 28px;
|
|
103
116
|
transform: translate(-50%, -50%);
|
|
@@ -108,8 +121,12 @@ const descriptionProps = computed(() => hasDescription.value
|
|
|
108
121
|
-webkit-backdrop-filter: var(--ylf-glass-blur, blur(16px));
|
|
109
122
|
backdrop-filter: var(--ylf-glass-blur, blur(16px));
|
|
110
123
|
|
|
124
|
+
&[data-state='closed'] {
|
|
125
|
+
animation: ylf-dialog-out var(--ylf-duration-exit, 160ms) var(--ylf-ease-standard, ease);
|
|
126
|
+
}
|
|
127
|
+
|
|
111
128
|
&[data-state='open'] {
|
|
112
|
-
animation: ylf-dialog-in var(--ylf-duration-
|
|
129
|
+
animation: ylf-dialog-in var(--ylf-duration-enter, 240ms) var(--ylf-ease-standard, ease);
|
|
113
130
|
}
|
|
114
131
|
|
|
115
132
|
&:focus-visible {
|
|
@@ -119,7 +136,7 @@ const descriptionProps = computed(() => hasDescription.value
|
|
|
119
136
|
|
|
120
137
|
.ylf-dialog__title {
|
|
121
138
|
margin: 0 0 10px;
|
|
122
|
-
padding-right:
|
|
139
|
+
padding-right: var(--ylf-touch-target, 44px);
|
|
123
140
|
overflow-wrap: anywhere;
|
|
124
141
|
font-family: var(--ylf-font-heading, inherit);
|
|
125
142
|
font-size: 24px;
|
|
@@ -153,12 +170,14 @@ const descriptionProps = computed(() => hasDescription.value
|
|
|
153
170
|
color: var(--ylf-c-text-3, #64748b);
|
|
154
171
|
cursor: pointer;
|
|
155
172
|
transition:
|
|
156
|
-
background
|
|
157
|
-
color
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
173
|
+
background var(--ylf-duration-fast, 160ms) var(--ylf-ease-standard, ease),
|
|
174
|
+
color var(--ylf-duration-fast, 160ms) var(--ylf-ease-standard, ease);
|
|
175
|
+
|
|
176
|
+
@media (hover: hover) and (pointer: fine) {
|
|
177
|
+
&:hover {
|
|
178
|
+
background: var(--ylf-c-bg-mute, #e2e8f0);
|
|
179
|
+
color: var(--ylf-c-text, #0f172a);
|
|
180
|
+
}
|
|
162
181
|
}
|
|
163
182
|
|
|
164
183
|
&:focus-visible {
|
|
@@ -169,11 +188,6 @@ const descriptionProps = computed(() => hasDescription.value
|
|
|
169
188
|
svg {
|
|
170
189
|
width: 16px;
|
|
171
190
|
height: 16px;
|
|
172
|
-
transition: transform var(--ylf-duration-fast, 160ms) ease;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
&:hover svg {
|
|
176
|
-
transform: rotate(90deg);
|
|
177
191
|
}
|
|
178
192
|
}
|
|
179
193
|
|
|
@@ -181,8 +195,8 @@ const descriptionProps = computed(() => hasDescription.value
|
|
|
181
195
|
.ylf-dialog__close {
|
|
182
196
|
top: 10px;
|
|
183
197
|
right: 10px;
|
|
184
|
-
width: 44px;
|
|
185
|
-
height: 44px;
|
|
198
|
+
width: var(--ylf-touch-target, 44px);
|
|
199
|
+
height: var(--ylf-touch-target, 44px);
|
|
186
200
|
}
|
|
187
201
|
}
|
|
188
202
|
|
|
@@ -200,13 +214,31 @@ const descriptionProps = computed(() => hasDescription.value
|
|
|
200
214
|
}
|
|
201
215
|
|
|
202
216
|
@media (prefers-reduced-motion: reduce) {
|
|
203
|
-
.ylf-dialog__overlay[data-state
|
|
204
|
-
.ylf-dialog__content[data-state
|
|
217
|
+
.ylf-dialog__overlay[data-state],
|
|
218
|
+
.ylf-dialog__content[data-state] {
|
|
205
219
|
animation: none;
|
|
206
220
|
}
|
|
207
221
|
|
|
208
|
-
.ylf-dialog__close
|
|
222
|
+
.ylf-dialog__close {
|
|
209
223
|
transition: none;
|
|
210
224
|
}
|
|
211
225
|
}
|
|
226
|
+
@keyframes ylf-dialog-overlay-out {
|
|
227
|
+
to {
|
|
228
|
+
opacity: 0;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
@keyframes ylf-dialog-out {
|
|
233
|
+
to {
|
|
234
|
+
opacity: 0;
|
|
235
|
+
transform: translate(-50%, -50%) scale(0.98);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
@media (max-width: 480px) {
|
|
240
|
+
.ylf-dialog__content {
|
|
241
|
+
padding: var(--ylf-space-6, 24px);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
212
244
|
</style>
|
|
@@ -27,7 +27,7 @@ const open = defineModel<boolean>('open', { default: false })
|
|
|
27
27
|
<slot name="trigger" />
|
|
28
28
|
</DropdownMenuTrigger>
|
|
29
29
|
<DropdownMenuPortal :to="portalTo">
|
|
30
|
-
<DropdownMenuContent v-bind="$attrs" class="ylf-menu" :side-offset="6" align="start">
|
|
30
|
+
<DropdownMenuContent v-bind="$attrs" class="ylf-menu" :side-offset="6" :collision-padding="16" align="start">
|
|
31
31
|
<template v-for="(it, i) in items" :key="i">
|
|
32
32
|
<DropdownMenuSeparator v-if="it.separator" class="ylf-menu__sep" />
|
|
33
33
|
<DropdownMenuItem
|
|
@@ -47,7 +47,13 @@ const open = defineModel<boolean>('open', { default: false })
|
|
|
47
47
|
<style lang="scss">
|
|
48
48
|
.ylf-menu {
|
|
49
49
|
z-index: 105;
|
|
50
|
-
|
|
50
|
+
box-sizing: border-box;
|
|
51
|
+
min-width: min(180px, var(--reka-dropdown-menu-content-available-width, 100vw));
|
|
52
|
+
max-width: var(--reka-dropdown-menu-content-available-width, calc(100vw - 32px));
|
|
53
|
+
max-height: var(--reka-dropdown-menu-content-available-height, calc(100dvh - 32px));
|
|
54
|
+
overflow: auto;
|
|
55
|
+
overflow-wrap: anywhere;
|
|
56
|
+
overscroll-behavior: contain;
|
|
51
57
|
padding: 6px;
|
|
52
58
|
background: var(--ylf-c-panel, var(--ylf-c-surface, #fff));
|
|
53
59
|
border: 1px solid var(--ylf-c-border, #e2e8f0);
|
|
@@ -57,7 +63,24 @@ const open = defineModel<boolean>('open', { default: false })
|
|
|
57
63
|
transform-origin: var(--reka-dropdown-menu-content-transform-origin);
|
|
58
64
|
|
|
59
65
|
&[data-state='open'] {
|
|
60
|
-
animation: ylf-menu-in
|
|
66
|
+
animation: ylf-menu-in var(--ylf-duration-enter, 240ms) var(--ylf-ease-standard, ease);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&[data-state='closed'] {
|
|
70
|
+
animation: ylf-menu-out var(--ylf-duration-exit, 160ms) var(--ylf-ease-standard, ease);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&[data-side='bottom'] {
|
|
74
|
+
--_enter-y: -4px;
|
|
75
|
+
}
|
|
76
|
+
&[data-side='top'] {
|
|
77
|
+
--_enter-y: 4px;
|
|
78
|
+
}
|
|
79
|
+
&[data-side='left'] {
|
|
80
|
+
--_enter-x: 4px;
|
|
81
|
+
}
|
|
82
|
+
&[data-side='right'] {
|
|
83
|
+
--_enter-x: -4px;
|
|
61
84
|
}
|
|
62
85
|
|
|
63
86
|
&__item {
|
|
@@ -100,12 +123,19 @@ const open = defineModel<boolean>('open', { default: false })
|
|
|
100
123
|
@keyframes ylf-menu-in {
|
|
101
124
|
from {
|
|
102
125
|
opacity: 0;
|
|
103
|
-
transform: scale(0.96);
|
|
126
|
+
transform: translate(var(--_enter-x, 0), var(--_enter-y, 0)) scale(0.96);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@keyframes ylf-menu-out {
|
|
131
|
+
to {
|
|
132
|
+
opacity: 0;
|
|
133
|
+
transform: scale(0.97);
|
|
104
134
|
}
|
|
105
135
|
}
|
|
106
136
|
|
|
107
137
|
@media (prefers-reduced-motion: reduce) {
|
|
108
|
-
.ylf-menu[data-state
|
|
138
|
+
.ylf-menu[data-state] {
|
|
109
139
|
animation: none;
|
|
110
140
|
}
|
|
111
141
|
|
|
@@ -113,4 +143,10 @@ const open = defineModel<boolean>('open', { default: false })
|
|
|
113
143
|
transition: none;
|
|
114
144
|
}
|
|
115
145
|
}
|
|
146
|
+
@media (pointer: coarse) {
|
|
147
|
+
.ylf-menu__item {
|
|
148
|
+
box-sizing: border-box;
|
|
149
|
+
min-height: var(--ylf-touch-target, 44px);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
116
152
|
</style>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
withDefaults(defineProps<{
|
|
3
|
+
size?: 'sm' | 'md'
|
|
4
|
+
invalid?: boolean
|
|
5
|
+
}>(), { size: 'md', invalid: false })
|
|
6
|
+
|
|
7
|
+
const model = defineModel<string>({ default: '' })
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<input v-model="model" class="ylf-input" :data-size="size" :aria-invalid="invalid || undefined">
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<style scoped>
|
|
15
|
+
.ylf-input {
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
width: 100%;
|
|
18
|
+
min-width: 0;
|
|
19
|
+
min-height: 44px;
|
|
20
|
+
padding: 10px 14px;
|
|
21
|
+
border: 1px solid var(--ylf-c-border-strong, #cbd5e1);
|
|
22
|
+
border-radius: var(--ylf-radius, 14px);
|
|
23
|
+
background: var(--ylf-c-surface, #fff);
|
|
24
|
+
color: var(--ylf-c-text, #0f172a);
|
|
25
|
+
font-family: var(--ylf-font-body, inherit);
|
|
26
|
+
font-size: 15px;
|
|
27
|
+
line-height: 1.5;
|
|
28
|
+
box-shadow: var(--ylf-shadow-control);
|
|
29
|
+
transition: border-color var(--ylf-duration-fast, 160ms) var(--ylf-ease-standard, ease);
|
|
30
|
+
}
|
|
31
|
+
.ylf-input::placeholder {
|
|
32
|
+
color: var(--ylf-c-text-3, #64748b);
|
|
33
|
+
}
|
|
34
|
+
.ylf-input:hover:not(:disabled, :read-only) {
|
|
35
|
+
border-color: var(--ylf-c-brand, #2563eb);
|
|
36
|
+
}
|
|
37
|
+
.ylf-input:focus-visible {
|
|
38
|
+
outline: 2px solid var(--ylf-c-brand, #2563eb);
|
|
39
|
+
outline-offset: 2px;
|
|
40
|
+
}
|
|
41
|
+
.ylf-input[aria-invalid='true'] {
|
|
42
|
+
border-color: var(--ylf-status-danger-text, #b42318);
|
|
43
|
+
}
|
|
44
|
+
.ylf-input[aria-invalid='true']:focus-visible {
|
|
45
|
+
outline-color: var(--ylf-status-danger-text, #b42318);
|
|
46
|
+
}
|
|
47
|
+
.ylf-input:disabled {
|
|
48
|
+
opacity: 0.5;
|
|
49
|
+
cursor: not-allowed;
|
|
50
|
+
}
|
|
51
|
+
.ylf-input[data-size='sm'] {
|
|
52
|
+
min-height: 34px;
|
|
53
|
+
padding: 5px 10px;
|
|
54
|
+
border-radius: var(--ylf-radius-sm, 10px);
|
|
55
|
+
font-size: 12px;
|
|
56
|
+
}
|
|
57
|
+
@media (pointer: coarse) {
|
|
58
|
+
.ylf-input[data-size='sm'] {
|
|
59
|
+
min-height: 44px;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
@media (prefers-reduced-motion: reduce) {
|
|
63
|
+
.ylf-input {
|
|
64
|
+
transition: none;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
</style>
|
package/components/YlfLogo.vue
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
+
import { icons } from '@yunlefun/icons'
|
|
3
|
+
|
|
2
4
|
withDefaults(defineProps<{
|
|
3
5
|
size?: 'sm' | 'md' | 'lg'
|
|
4
6
|
layout?: 'vertical' | 'horizontal'
|
|
@@ -9,16 +11,16 @@ withDefaults(defineProps<{
|
|
|
9
11
|
layout: 'vertical',
|
|
10
12
|
wordmark: true,
|
|
11
13
|
})
|
|
14
|
+
const mark = icons.icons['brand-mark']
|
|
15
|
+
const viewBox = `0 0 ${mark.width || icons.width || 16} ${mark.height || icons.height || 16}`
|
|
12
16
|
</script>
|
|
13
17
|
|
|
14
18
|
<template>
|
|
15
19
|
<div class="ylf-logo" :class="[`ylf-logo--${size}`, `ylf-logo--${layout}`]">
|
|
16
20
|
<span class="ylf-logo__mark" aria-hidden="true">
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M85 0H15V15H0V55H15V70H85V55H100V15H85V0ZM85 15H15V55H85V15Z" />
|
|
21
|
-
</svg>
|
|
21
|
+
<!-- Trusted, sanitized SVG body from the canonical Iconify package. -->
|
|
22
|
+
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
23
|
+
<svg :viewBox="viewBox" fill="currentColor" v-html="mark.body" />
|
|
22
24
|
</span>
|
|
23
25
|
<span v-if="wordmark" class="ylf-logo__name">云乐坊</span>
|
|
24
26
|
</div>
|