@yunlefun/vue 0.8.1 → 0.10.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/components/YlfButton.vue +11 -10
- package/components/YlfCheckbox.vue +1 -1
- package/components/YlfCuteCloud.vue +246 -0
- package/components/YlfInput.vue +11 -6
- package/components/YlfRadioGroup.vue +1 -1
- package/components/YlfSelect.vue +6 -9
- package/components/YlfSwitch.vue +1 -1
- package/components/cute-cloud/demo.vue +73 -0
- package/components/cute-cloud/index.md +34 -0
- package/components/cute-cloud.ts +16 -0
- package/dist/components/YlfCuteCloud.vue.d.ts +25 -0
- package/dist/components/cute-cloud.d.ts +10 -0
- package/dist/index.cjs +7 -0
- package/dist/index.d.cts +13 -2
- package/dist/index.d.mts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.mjs +7 -1
- package/package.json +1 -1
package/components/YlfButton.vue
CHANGED
|
@@ -221,21 +221,22 @@ function onClick(e: MouseEvent) {
|
|
|
221
221
|
.ylf-button--primary {
|
|
222
222
|
color: var(--ylf-c-text-on-accent, #fff);
|
|
223
223
|
background: var(--ylf-c-brand, #006aeb);
|
|
224
|
-
border-color:
|
|
224
|
+
border-color: var(--ylf-c-brand-hover, #0057c7);
|
|
225
225
|
box-shadow:
|
|
226
226
|
inset 0 1px 0 rgba(255, 255, 255, 0.22),
|
|
227
|
-
0 2px
|
|
228
|
-
0 6px 14px -6px color-mix(in srgb, var(--_fill)
|
|
227
|
+
0 1px 2px color-mix(in srgb, var(--ylf-c-brand-active, #0047a6) 24%, transparent),
|
|
228
|
+
0 6px 14px -6px color-mix(in srgb, var(--_fill) 42%, transparent);
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
@media (hover: hover) and (pointer: fine) {
|
|
232
232
|
.ylf-button--primary:hover:not(.is-disabled, .is-loading, :disabled) {
|
|
233
233
|
background: var(--ylf-c-brand-hover, #0057c7);
|
|
234
|
+
border-color: var(--ylf-c-brand-active, #0047a6);
|
|
234
235
|
transform: translateY(var(--ylf-hover-lift, -1px));
|
|
235
236
|
box-shadow:
|
|
236
|
-
inset 0 1px 0 rgba(255, 255, 255, 0.
|
|
237
|
-
0
|
|
238
|
-
0 8px 18px -6px color-mix(in srgb, var(--_fill)
|
|
237
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.24),
|
|
238
|
+
0 2px 4px color-mix(in srgb, var(--ylf-c-brand-active, #0047a6) 26%, transparent),
|
|
239
|
+
0 8px 18px -6px color-mix(in srgb, var(--_fill) 38%, transparent);
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
242
|
|
|
@@ -249,11 +250,11 @@ function onClick(e: MouseEvent) {
|
|
|
249
250
|
|
|
250
251
|
color: var(--ylf-accent-on, var(--ylf-c-text-on-accent, #fff));
|
|
251
252
|
background: var(--ylf-accent, var(--ylf-c-brand, #006aeb));
|
|
252
|
-
border-color:
|
|
253
|
+
border-color: var(--ylf-accent-hover, var(--ylf-c-brand-hover, #0057c7));
|
|
253
254
|
box-shadow:
|
|
254
255
|
inset 0 1px 0 rgba(255, 255, 255, 0.22),
|
|
255
|
-
0 2px
|
|
256
|
-
0 6px 14px -6px color-mix(in srgb, var(--_fill)
|
|
256
|
+
0 1px 2px color-mix(in srgb, var(--_fill) 24%, transparent),
|
|
257
|
+
0 6px 14px -6px color-mix(in srgb, var(--_fill) 34%, transparent);
|
|
257
258
|
}
|
|
258
259
|
|
|
259
260
|
@media (hover: hover) and (pointer: fine) {
|
|
@@ -268,7 +269,7 @@ function onClick(e: MouseEvent) {
|
|
|
268
269
|
.ylf-button--secondary {
|
|
269
270
|
color: var(--ylf-c-text, #0f172a);
|
|
270
271
|
background: var(--ylf-c-surface, #fff);
|
|
271
|
-
border-color: var(--ylf-c-border-control, #
|
|
272
|
+
border-color: var(--ylf-c-border-control, #cbd5e1);
|
|
272
273
|
box-shadow: var(--ylf-shadow-control);
|
|
273
274
|
}
|
|
274
275
|
|
|
@@ -48,7 +48,7 @@ watch(checked, () => {
|
|
|
48
48
|
display: inline-grid;
|
|
49
49
|
place-items: center;
|
|
50
50
|
padding: 0;
|
|
51
|
-
border: 2px solid var(--ylf-c-border-
|
|
51
|
+
border: 2px solid var(--ylf-c-border-indicator, #7d8ca0);
|
|
52
52
|
border-radius: 7px;
|
|
53
53
|
background: var(--ylf-c-surface, #fff);
|
|
54
54
|
box-shadow: var(--ylf-shadow-control);
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { YlfCuteCloudLook, YlfCuteCloudMood, YlfCuteCloudShape } from './cute-cloud'
|
|
3
|
+
import { computed, useId } from 'vue'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 卡通小云:几团圆鼓鼓的扁平色块拼成,底部一道柔和阴影,可选一张会眨眼的小脸。
|
|
7
|
+
*
|
|
8
|
+
* 比写实的 YlfCloud 更简单、更可爱,用于个人中心、认证卡片等轻松场景。
|
|
9
|
+
* 配色读取 `--ylf-cloud-*` 主题 token,浅色是白日白云,深色是夜空或黄昏云。
|
|
10
|
+
* `mood="happy"` 时眯成 ^ ^ 眼、腮红变深;`look` 传入 -1..1 方向时眼睛朝对应方向看。
|
|
11
|
+
*/
|
|
12
|
+
const props = withDefaults(defineProps<{
|
|
13
|
+
shape?: YlfCuteCloudShape
|
|
14
|
+
face?: boolean
|
|
15
|
+
mood?: YlfCuteCloudMood
|
|
16
|
+
/** 装饰性眨眼;表单等专注操作的场景可关闭。 */
|
|
17
|
+
animated?: boolean
|
|
18
|
+
/** 视线方向,x / y 取 -1..1。 */
|
|
19
|
+
look?: YlfCuteCloudLook
|
|
20
|
+
}>(), {
|
|
21
|
+
shape: 'round',
|
|
22
|
+
face: false,
|
|
23
|
+
mood: 'calm',
|
|
24
|
+
animated: true,
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
interface Bump {
|
|
28
|
+
cx: number
|
|
29
|
+
cy: number
|
|
30
|
+
r: number
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface Silhouette {
|
|
34
|
+
width: number
|
|
35
|
+
height: number
|
|
36
|
+
base: { x: number, y: number, w: number, h: number }
|
|
37
|
+
bumps: readonly Bump[]
|
|
38
|
+
face: { x: number, y: number }
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const SHAPES: Record<YlfCuteCloudShape, Silhouette> = {
|
|
42
|
+
round: {
|
|
43
|
+
width: 120,
|
|
44
|
+
height: 72,
|
|
45
|
+
base: { x: 12, y: 40, w: 96, h: 28 },
|
|
46
|
+
bumps: [
|
|
47
|
+
{ cx: 36, cy: 44, r: 18 },
|
|
48
|
+
{ cx: 62, cy: 32, r: 24 },
|
|
49
|
+
{ cx: 88, cy: 44, r: 17 },
|
|
50
|
+
],
|
|
51
|
+
face: { x: 62, y: 50 },
|
|
52
|
+
},
|
|
53
|
+
long: {
|
|
54
|
+
width: 170,
|
|
55
|
+
height: 64,
|
|
56
|
+
base: { x: 8, y: 36, w: 154, h: 24 },
|
|
57
|
+
bumps: [
|
|
58
|
+
{ cx: 32, cy: 38, r: 16 },
|
|
59
|
+
{ cx: 60, cy: 28, r: 21 },
|
|
60
|
+
{ cx: 94, cy: 24, r: 22 },
|
|
61
|
+
{ cx: 126, cy: 34, r: 17 },
|
|
62
|
+
],
|
|
63
|
+
face: { x: 94, y: 44 },
|
|
64
|
+
},
|
|
65
|
+
small: {
|
|
66
|
+
width: 100,
|
|
67
|
+
height: 46,
|
|
68
|
+
base: { x: 6, y: 24, w: 88, h: 18 },
|
|
69
|
+
bumps: [
|
|
70
|
+
{ cx: 34, cy: 24, r: 13 },
|
|
71
|
+
{ cx: 60, cy: 20, r: 15 },
|
|
72
|
+
],
|
|
73
|
+
face: { x: 50, y: 32 },
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const shapeDef = computed(() => SHAPES[props.shape] ?? SHAPES.round)
|
|
78
|
+
const shinePath = computed(() => {
|
|
79
|
+
const first = shapeDef.value.bumps[0]!
|
|
80
|
+
return `M ${first.cx - first.r * 0.55} ${first.cy - first.r * 0.15} q ${first.r * 0.15} ${-first.r * 0.5} ${first.r * 0.6} ${-first.r * 0.55}`
|
|
81
|
+
})
|
|
82
|
+
const gazeTransform = computed(() => {
|
|
83
|
+
if (!props.look)
|
|
84
|
+
return undefined
|
|
85
|
+
const x = (Math.max(-1, Math.min(1, props.look.x)) * 2.2).toFixed(2)
|
|
86
|
+
const y = (Math.max(-1, Math.min(1, props.look.y)) * 1.4).toFixed(2)
|
|
87
|
+
return `translate(${x} ${y})`
|
|
88
|
+
})
|
|
89
|
+
const id = `ylf-cute-cloud-${useId()}`
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<template>
|
|
93
|
+
<svg
|
|
94
|
+
class="ylf-cute-cloud"
|
|
95
|
+
:class="{
|
|
96
|
+
'ylf-cute-cloud--happy': mood === 'happy',
|
|
97
|
+
'ylf-cute-cloud--still': !animated,
|
|
98
|
+
}"
|
|
99
|
+
:data-shape="shape"
|
|
100
|
+
:viewBox="`0 0 ${shapeDef.width} ${shapeDef.height}`"
|
|
101
|
+
fill="none"
|
|
102
|
+
focusable="false"
|
|
103
|
+
aria-hidden="true"
|
|
104
|
+
>
|
|
105
|
+
<defs>
|
|
106
|
+
<clipPath :id="`${id}-clip`">
|
|
107
|
+
<rect
|
|
108
|
+
:x="shapeDef.base.x"
|
|
109
|
+
:y="shapeDef.base.y"
|
|
110
|
+
:width="shapeDef.base.w"
|
|
111
|
+
:height="shapeDef.base.h"
|
|
112
|
+
:rx="shapeDef.base.h / 2"
|
|
113
|
+
/>
|
|
114
|
+
<circle v-for="(bump, index) in shapeDef.bumps" :key="index" :cx="bump.cx" :cy="bump.cy" :r="bump.r" />
|
|
115
|
+
</clipPath>
|
|
116
|
+
</defs>
|
|
117
|
+
|
|
118
|
+
<g :clip-path="`url(#${id}-clip)`">
|
|
119
|
+
<rect class="ylf-cute-cloud__body" width="100%" height="100%" />
|
|
120
|
+
<ellipse
|
|
121
|
+
class="ylf-cute-cloud__shade"
|
|
122
|
+
:cx="shapeDef.width / 2"
|
|
123
|
+
:cy="shapeDef.base.y + shapeDef.base.h + 2"
|
|
124
|
+
:rx="shapeDef.width * 0.56"
|
|
125
|
+
:ry="shapeDef.base.h * 0.5"
|
|
126
|
+
/>
|
|
127
|
+
</g>
|
|
128
|
+
<path class="ylf-cute-cloud__shine" :d="shinePath" />
|
|
129
|
+
|
|
130
|
+
<g v-if="face" class="ylf-cute-cloud__face" :transform="`translate(${shapeDef.face.x} ${shapeDef.face.y})`">
|
|
131
|
+
<ellipse class="ylf-cute-cloud__blush" cx="-14" cy="4" rx="4.5" ry="2.6" />
|
|
132
|
+
<ellipse class="ylf-cute-cloud__blush" cx="14" cy="4" rx="4.5" ry="2.6" />
|
|
133
|
+
<g class="ylf-cute-cloud__eyes" :transform="gazeTransform">
|
|
134
|
+
<ellipse class="ylf-cute-cloud__eye" cx="-7" cy="-1" rx="2.2" ry="2.8" />
|
|
135
|
+
<ellipse class="ylf-cute-cloud__eye" cx="7" cy="-1" rx="2.2" ry="2.8" />
|
|
136
|
+
</g>
|
|
137
|
+
<g class="ylf-cute-cloud__happy-eyes">
|
|
138
|
+
<path d="M -9.5 0 q 2.5 -4 5 0" />
|
|
139
|
+
<path d="M 4.5 0 q 2.5 -4 5 0" />
|
|
140
|
+
</g>
|
|
141
|
+
<path class="ylf-cute-cloud__mouth" d="M -3 3.5 q 3 3 6 0" />
|
|
142
|
+
</g>
|
|
143
|
+
</svg>
|
|
144
|
+
</template>
|
|
145
|
+
|
|
146
|
+
<style>
|
|
147
|
+
.ylf-cute-cloud {
|
|
148
|
+
--_body: var(--ylf-cloud-highlight, #fffefa);
|
|
149
|
+
--_shade: color-mix(in srgb, var(--ylf-cloud-shade, #c6dff5) 70%, var(--_body));
|
|
150
|
+
--_face: var(--ylf-cloud-face, #5a7fae);
|
|
151
|
+
|
|
152
|
+
overflow: visible;
|
|
153
|
+
pointer-events: none;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/* 尺寸默认铺满容器;用 :where 降到零优先级,使用处的宽度、定位可以直接覆盖。 */
|
|
157
|
+
:where(.ylf-cute-cloud) {
|
|
158
|
+
display: block;
|
|
159
|
+
width: 100%;
|
|
160
|
+
height: auto;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.ylf-cute-cloud__body {
|
|
164
|
+
fill: var(--_body);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.ylf-cute-cloud__shade {
|
|
168
|
+
fill: var(--_shade);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.ylf-cute-cloud__shine {
|
|
172
|
+
fill: none;
|
|
173
|
+
stroke: var(--ylf-cloud-rim, #ffffff);
|
|
174
|
+
stroke-linecap: round;
|
|
175
|
+
stroke-width: 2.5;
|
|
176
|
+
opacity: 0.9;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.ylf-cute-cloud__eye {
|
|
180
|
+
fill: var(--_face);
|
|
181
|
+
transform-box: fill-box;
|
|
182
|
+
transform-origin: center;
|
|
183
|
+
animation: ylf-cute-cloud-blink 5.2s ease-in-out infinite;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.ylf-cute-cloud--still .ylf-cute-cloud__eye {
|
|
187
|
+
animation: none;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.ylf-cute-cloud__happy-eyes path,
|
|
191
|
+
.ylf-cute-cloud__mouth {
|
|
192
|
+
fill: none;
|
|
193
|
+
stroke: var(--_face);
|
|
194
|
+
stroke-linecap: round;
|
|
195
|
+
stroke-width: 1.6;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.ylf-cute-cloud__blush {
|
|
199
|
+
fill: var(--ylf-palette-pink, #ec4899);
|
|
200
|
+
opacity: 0.28;
|
|
201
|
+
transition: opacity var(--ylf-duration-normal, 240ms) var(--ylf-ease-standard, cubic-bezier(0.2, 0, 0, 1));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.ylf-cute-cloud__happy-eyes {
|
|
205
|
+
opacity: 0;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.ylf-cute-cloud__eyes {
|
|
209
|
+
transition: transform 180ms var(--ylf-ease-standard, cubic-bezier(0.2, 0, 0, 1));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.ylf-cute-cloud--happy .ylf-cute-cloud__eyes {
|
|
213
|
+
opacity: 0;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.ylf-cute-cloud--happy .ylf-cute-cloud__happy-eyes {
|
|
217
|
+
opacity: 1;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.ylf-cute-cloud--happy .ylf-cute-cloud__blush {
|
|
221
|
+
opacity: 0.56;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@keyframes ylf-cute-cloud-blink {
|
|
225
|
+
0%,
|
|
226
|
+
92%,
|
|
227
|
+
100% {
|
|
228
|
+
transform: scaleY(1);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
95% {
|
|
232
|
+
transform: scaleY(0.1);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
@media (prefers-reduced-motion: reduce) {
|
|
237
|
+
.ylf-cute-cloud__blush,
|
|
238
|
+
.ylf-cute-cloud__eyes {
|
|
239
|
+
transition: none;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.ylf-cute-cloud__eye {
|
|
243
|
+
animation: none;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
</style>
|
package/components/YlfInput.vue
CHANGED
|
@@ -18,7 +18,7 @@ const model = defineModel<string>({ default: '' })
|
|
|
18
18
|
min-width: 0;
|
|
19
19
|
height: var(--ylf-control-h, 44px);
|
|
20
20
|
padding: 0 14px;
|
|
21
|
-
border: 1px solid var(--ylf-c-border-control, #
|
|
21
|
+
border: 1px solid var(--ylf-c-border-control, #cbd5e1);
|
|
22
22
|
border-radius: var(--ylf-control-radius, var(--ylf-radius, 14px));
|
|
23
23
|
background: var(--ylf-c-surface, #fff);
|
|
24
24
|
color: var(--ylf-c-text, #0f172a);
|
|
@@ -26,23 +26,28 @@ const model = defineModel<string>({ default: '' })
|
|
|
26
26
|
font-size: var(--ylf-control-font-size, 0.9375rem);
|
|
27
27
|
line-height: 1.5;
|
|
28
28
|
box-shadow: var(--ylf-shadow-control);
|
|
29
|
-
transition:
|
|
29
|
+
transition:
|
|
30
|
+
border-color var(--ylf-duration-fast, 160ms) var(--ylf-ease-standard, cubic-bezier(0.2, 0, 0, 1)),
|
|
31
|
+
box-shadow var(--ylf-duration-fast, 160ms) var(--ylf-ease-standard, cubic-bezier(0.2, 0, 0, 1));
|
|
30
32
|
}
|
|
31
33
|
.ylf-input::placeholder {
|
|
32
34
|
color: var(--ylf-c-placeholder, var(--ylf-c-text-3, #5a697e));
|
|
33
35
|
}
|
|
34
36
|
.ylf-input:hover:not(:disabled, :read-only) {
|
|
35
|
-
border-color: var(--ylf-c-brand, #006aeb);
|
|
37
|
+
border-color: color-mix(in srgb, var(--ylf-c-brand, #006aeb) 52%, var(--ylf-c-border-control, #cbd5e1));
|
|
36
38
|
}
|
|
37
39
|
.ylf-input:focus-visible {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
border-color: var(--ylf-ring-color, var(--ylf-c-brand, #006aeb));
|
|
41
|
+
box-shadow: var(--ylf-shadow-focus);
|
|
42
|
+
outline: var(--ylf-ring-width, 2px) solid transparent;
|
|
40
43
|
}
|
|
41
44
|
.ylf-input[aria-invalid='true'] {
|
|
42
45
|
border-color: var(--ylf-status-danger-text, #b91c1c);
|
|
43
46
|
}
|
|
44
47
|
.ylf-input[aria-invalid='true']:focus-visible {
|
|
45
|
-
|
|
48
|
+
border-color: var(--ylf-status-danger-text, #b91c1c);
|
|
49
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--ylf-status-danger-text, #b91c1c) 14%, transparent);
|
|
50
|
+
outline: var(--ylf-ring-width, 2px) solid transparent;
|
|
46
51
|
}
|
|
47
52
|
.ylf-input:disabled {
|
|
48
53
|
opacity: var(--ylf-disabled-opacity, 0.48);
|
|
@@ -108,7 +108,7 @@ function selectFocusedRadio(event: KeyboardEvent) {
|
|
|
108
108
|
height: 20px;
|
|
109
109
|
display: inline-grid;
|
|
110
110
|
place-items: center;
|
|
111
|
-
border: 2px solid var(--ylf-c-border-
|
|
111
|
+
border: 2px solid var(--ylf-c-border-indicator, #7d8ca0);
|
|
112
112
|
border-radius: 50%;
|
|
113
113
|
background: var(--ylf-c-surface, #fff);
|
|
114
114
|
box-shadow: var(--ylf-shadow-control);
|
package/components/YlfSelect.vue
CHANGED
|
@@ -92,7 +92,7 @@ const viewport = useTemplateRef<HTMLElement>('viewport')
|
|
|
92
92
|
line-height: 1.5;
|
|
93
93
|
color: var(--ylf-c-text, #0f172a);
|
|
94
94
|
background: var(--ylf-c-surface, #fff);
|
|
95
|
-
border: 1px solid var(--ylf-c-border-control, #
|
|
95
|
+
border: 1px solid var(--ylf-c-border-control, #cbd5e1);
|
|
96
96
|
border-radius: var(--ylf-control-radius, var(--ylf-radius, 14px));
|
|
97
97
|
box-shadow: var(--ylf-shadow-control);
|
|
98
98
|
cursor: pointer;
|
|
@@ -107,22 +107,19 @@ const viewport = useTemplateRef<HTMLElement>('viewport')
|
|
|
107
107
|
|
|
108
108
|
@media (hover: hover) and (pointer: fine) {
|
|
109
109
|
.ylf-select__trigger:hover:not([data-disabled]) {
|
|
110
|
-
border-color: var(--ylf-c-brand, #006aeb);
|
|
110
|
+
border-color: color-mix(in srgb, var(--ylf-c-brand, #006aeb) 52%, var(--ylf-c-border-control, #cbd5e1));
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
.ylf-select__trigger[data-state='open'] {
|
|
115
115
|
border-color: var(--ylf-c-brand, #006aeb);
|
|
116
|
-
box-shadow:
|
|
117
|
-
var(--ylf-shadow-control),
|
|
118
|
-
0 0 0 3px var(--ylf-c-brand-soft, #f0f7ff);
|
|
116
|
+
box-shadow: var(--ylf-shadow-control), var(--ylf-shadow-focus);
|
|
119
117
|
}
|
|
120
118
|
|
|
121
119
|
.ylf-select__trigger:focus-visible {
|
|
122
|
-
outline: var(--ylf-ring-width, 2px) solid
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
box-shadow: 0 0 0 3px var(--ylf-c-brand-soft, #f0f7ff);
|
|
120
|
+
outline: var(--ylf-ring-width, 2px) solid transparent;
|
|
121
|
+
border-color: var(--ylf-ring-color, var(--ylf-c-brand, #006aeb));
|
|
122
|
+
box-shadow: var(--ylf-shadow-focus);
|
|
126
123
|
}
|
|
127
124
|
|
|
128
125
|
.ylf-select__trigger[data-disabled] {
|
package/components/YlfSwitch.vue
CHANGED
|
@@ -49,7 +49,7 @@ const checked = defineModel<boolean>({ default: false })
|
|
|
49
49
|
background: var(--ylf-c-bg-mute, #e2e8f0);
|
|
50
50
|
box-shadow:
|
|
51
51
|
var(--ylf-shadow-inset),
|
|
52
|
-
inset 0 0 0 1px var(--ylf-c-border-
|
|
52
|
+
inset 0 0 0 1px var(--ylf-c-border-indicator, #7d8ca0);
|
|
53
53
|
cursor: pointer;
|
|
54
54
|
-webkit-tap-highlight-color: transparent;
|
|
55
55
|
transition:
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { YlfCuteCloudMood, YlfCuteCloudShape } from '../cute-cloud'
|
|
3
|
+
import { computed, ref, useId } from 'vue'
|
|
4
|
+
|
|
5
|
+
const shape = ref<YlfCuteCloudShape>('round')
|
|
6
|
+
const face = ref(true)
|
|
7
|
+
const happy = ref(false)
|
|
8
|
+
const animated = ref(true)
|
|
9
|
+
const lookRight = ref(false)
|
|
10
|
+
const faceId = useId()
|
|
11
|
+
const happyId = useId()
|
|
12
|
+
const animatedId = useId()
|
|
13
|
+
const lookId = useId()
|
|
14
|
+
|
|
15
|
+
const shapes: { value: YlfCuteCloudShape, label: string }[] = [
|
|
16
|
+
{ value: 'round', label: '圆云' },
|
|
17
|
+
{ value: 'long', label: '长云' },
|
|
18
|
+
{ value: 'small', label: '小云' },
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
const mood = computed<YlfCuteCloudMood>(() => happy.value ? 'happy' : 'calm')
|
|
22
|
+
const look = computed(() => lookRight.value
|
|
23
|
+
? { x: 0.8, y: 0.4 }
|
|
24
|
+
: { x: -0.6, y: 0.4 })
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<div class="flex flex-col gap-5">
|
|
29
|
+
<div class="cute-cloud-demo__stage">
|
|
30
|
+
<YlfCuteCloud
|
|
31
|
+
:shape="shape"
|
|
32
|
+
:face="face"
|
|
33
|
+
:mood="mood"
|
|
34
|
+
:animated="animated"
|
|
35
|
+
:look="look"
|
|
36
|
+
class="cute-cloud-demo__cloud"
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
39
|
+
<YlfSegmentedControl v-model="shape" :options="shapes" label="小云形状" />
|
|
40
|
+
<div class="flex flex-wrap items-center gap-6">
|
|
41
|
+
<label class="flex items-center gap-2 text-sm" :for="faceId">
|
|
42
|
+
<YlfSwitch :id="faceId" v-model="face" size="sm" />
|
|
43
|
+
小脸
|
|
44
|
+
</label>
|
|
45
|
+
<label class="flex items-center gap-2 text-sm" :for="happyId">
|
|
46
|
+
<YlfSwitch :id="happyId" v-model="happy" size="sm" :disabled="!face" />
|
|
47
|
+
开心
|
|
48
|
+
</label>
|
|
49
|
+
<label class="flex items-center gap-2 text-sm" :for="animatedId">
|
|
50
|
+
<YlfSwitch :id="animatedId" v-model="animated" size="sm" :disabled="!face" />
|
|
51
|
+
眨眼
|
|
52
|
+
</label>
|
|
53
|
+
<label class="flex items-center gap-2 text-sm" :for="lookId">
|
|
54
|
+
<YlfSwitch :id="lookId" v-model="lookRight" size="sm" :disabled="!face || happy" />
|
|
55
|
+
向右看
|
|
56
|
+
</label>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<style scoped>
|
|
62
|
+
.cute-cloud-demo__stage {
|
|
63
|
+
display: grid;
|
|
64
|
+
place-items: center;
|
|
65
|
+
height: 180px;
|
|
66
|
+
border-radius: var(--ylf-radius-lg);
|
|
67
|
+
background: linear-gradient(180deg, var(--ylf-c-sky), var(--ylf-cloud-haze-color));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.cute-cloud-demo__cloud {
|
|
71
|
+
width: 140px;
|
|
72
|
+
}
|
|
73
|
+
</style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: CuteCloud
|
|
3
|
+
title_zh: 卡通小云
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
圆润简洁的卡通云朵插画,用于认证卡片、空状态和个人中心等轻松场景:支持三种轮廓、可选小脸表情、`mood` 切换以及视线跟随。配色同样来自 `@yunlefun/ui` 的 `--ylf-cloud-*` token,随明暗主题自动切换。纯装饰,`aria-hidden="true"`,不接收指针事件。
|
|
7
|
+
|
|
8
|
+
## 轮廓与表情
|
|
9
|
+
|
|
10
|
+
- `shape` 支持三种固定比例的轮廓:`round`(`120 × 72`)、`long`(`170 × 64`)、`small`(`100 × 46`)。
|
|
11
|
+
- 开启 `face` 后会渲染一张默认就会偶尔眨眼的小脸;表单输入密码或需要静态装饰时可传入 `:animated="false"` 暂停眨眼。
|
|
12
|
+
- `mood="happy"` 时眼睛眯成 `^ ^` 微笑弧线并加深腮红。
|
|
13
|
+
- `look` 传入 `{ x, y }`(均限制在 `-1..1`)可让眼睛看向指定方向,并使用 SVG `transform` 属性驱动,兼容严格的 `style-src 'self'` CSP。
|
|
14
|
+
|
|
15
|
+
## Props
|
|
16
|
+
|
|
17
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
18
|
+
| ---------- | -------------------------- | -------------------------- | ------- |
|
|
19
|
+
| `shape` | 云朵轮廓 | `round \| long \| small` | `round` |
|
|
20
|
+
| `face` | 是否显示小脸表情 | `boolean` | `false` |
|
|
21
|
+
| `mood` | 小脸心情 | `calm \| happy` | `calm` |
|
|
22
|
+
| `animated` | 是否启用眨眼动画 | `boolean` | `true` |
|
|
23
|
+
| `look` | 视线方向(自动钳制 -1..1) | `{ x: number, y: number }` | `—` |
|
|
24
|
+
|
|
25
|
+
## CSS 变量
|
|
26
|
+
|
|
27
|
+
| 变量 | 说明 | 默认值 |
|
|
28
|
+
| ----------------------- | ------------ | ------------------------ |
|
|
29
|
+
| `--ylf-cloud-highlight` | 云朵亮面底色 | `#fffefa` |
|
|
30
|
+
| `--ylf-cloud-shade` | 底部阴影色调 | `#c6dff5`(按 70% 混入) |
|
|
31
|
+
| `--ylf-cloud-rim` | 左上角高光 | `#ffffff` |
|
|
32
|
+
| `--ylf-cloud-face` | 五官线条颜色 | `#5a7fae` |
|
|
33
|
+
|
|
34
|
+
轮廓列表与类型也可从包根入口导出:`import { ylfCuteCloudShapes, type YlfCuteCloudShape } from '@yunlefun/vue'`。
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Silhouettes supported by `YlfCuteCloud`. */
|
|
2
|
+
export const ylfCuteCloudShapes = [
|
|
3
|
+
'round',
|
|
4
|
+
'long',
|
|
5
|
+
'small',
|
|
6
|
+
] as const
|
|
7
|
+
|
|
8
|
+
export type YlfCuteCloudShape = typeof ylfCuteCloudShapes[number]
|
|
9
|
+
export type YlfCuteCloudMood = 'calm' | 'happy'
|
|
10
|
+
|
|
11
|
+
export interface YlfCuteCloudLook {
|
|
12
|
+
/** Horizontal gaze direction, clamped to `-1..1`. */
|
|
13
|
+
x: number
|
|
14
|
+
/** Vertical gaze direction, clamped to `-1..1`. */
|
|
15
|
+
y: number
|
|
16
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { YlfCuteCloudLook, YlfCuteCloudMood, YlfCuteCloudShape } from './cute-cloud';
|
|
2
|
+
/**
|
|
3
|
+
* 卡通小云:几团圆鼓鼓的扁平色块拼成,底部一道柔和阴影,可选一张会眨眼的小脸。
|
|
4
|
+
*
|
|
5
|
+
* 比写实的 YlfCloud 更简单、更可爱,用于个人中心、认证卡片等轻松场景。
|
|
6
|
+
* 配色读取 `--ylf-cloud-*` 主题 token,浅色是白日白云,深色是夜空或黄昏云。
|
|
7
|
+
* `mood="happy"` 时眯成 ^ ^ 眼、腮红变深;`look` 传入 -1..1 方向时眼睛朝对应方向看。
|
|
8
|
+
*/
|
|
9
|
+
type __VLS_Props = {
|
|
10
|
+
shape?: YlfCuteCloudShape;
|
|
11
|
+
face?: boolean;
|
|
12
|
+
mood?: YlfCuteCloudMood;
|
|
13
|
+
/** 装饰性眨眼;表单等专注操作的场景可关闭。 */
|
|
14
|
+
animated?: boolean;
|
|
15
|
+
/** 视线方向,x / y 取 -1..1。 */
|
|
16
|
+
look?: YlfCuteCloudLook;
|
|
17
|
+
};
|
|
18
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
19
|
+
shape: "small" | "round" | "long";
|
|
20
|
+
face: boolean;
|
|
21
|
+
mood: YlfCuteCloudMood;
|
|
22
|
+
animated: boolean;
|
|
23
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
declare const _default: typeof __VLS_export;
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Silhouettes supported by `YlfCuteCloud`. */
|
|
2
|
+
export declare const ylfCuteCloudShapes: readonly ["round", "long", "small"];
|
|
3
|
+
export type YlfCuteCloudShape = typeof ylfCuteCloudShapes[number];
|
|
4
|
+
export type YlfCuteCloudMood = 'calm' | 'happy';
|
|
5
|
+
export interface YlfCuteCloudLook {
|
|
6
|
+
/** Horizontal gaze direction, clamped to `-1..1`. */
|
|
7
|
+
x: number;
|
|
8
|
+
/** Vertical gaze direction, clamped to `-1..1`. */
|
|
9
|
+
y: number;
|
|
10
|
+
}
|
package/dist/index.cjs
CHANGED
|
@@ -20,5 +20,12 @@ const ylfCloudSilhouettes = {
|
|
|
20
20
|
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"
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
+
const ylfCuteCloudShapes = [
|
|
24
|
+
"round",
|
|
25
|
+
"long",
|
|
26
|
+
"small"
|
|
27
|
+
];
|
|
28
|
+
|
|
23
29
|
exports.ylfCloudShapes = ylfCloudShapes;
|
|
24
30
|
exports.ylfCloudSilhouettes = ylfCloudSilhouettes;
|
|
31
|
+
exports.ylfCuteCloudShapes = ylfCuteCloudShapes;
|
package/dist/index.d.cts
CHANGED
|
@@ -28,6 +28,17 @@ type YlfCloudShape = typeof ylfCloudShapes[number];
|
|
|
28
28
|
/** Shared SVG paths for cloud silhouettes (`viewBox="0 0 490 250"`). */
|
|
29
29
|
declare const ylfCloudSilhouettes: Record<YlfCloudShape, string>;
|
|
30
30
|
|
|
31
|
+
/** Silhouettes supported by `YlfCuteCloud`. */
|
|
32
|
+
declare const ylfCuteCloudShapes: readonly ["round", "long", "small"];
|
|
33
|
+
type YlfCuteCloudShape = typeof ylfCuteCloudShapes[number];
|
|
34
|
+
type YlfCuteCloudMood = 'calm' | 'happy';
|
|
35
|
+
interface YlfCuteCloudLook {
|
|
36
|
+
/** Horizontal gaze direction, clamped to `-1..1`. */
|
|
37
|
+
x: number;
|
|
38
|
+
/** Vertical gaze direction, clamped to `-1..1`. */
|
|
39
|
+
y: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
31
42
|
/** One choice in a single-selection segmented control. */
|
|
32
43
|
interface YlfSegmentedOption<T extends string = string> {
|
|
33
44
|
value: T;
|
|
@@ -42,5 +53,5 @@ type YlfAccentTone = 'blue' | 'sun' | 'cyan' | 'coral' | 'pink' | 'green';
|
|
|
42
53
|
/** Visual emphasis for accent and status buttons/badges. */
|
|
43
54
|
type YlfColorAppearance = 'solid' | 'soft' | 'outline';
|
|
44
55
|
|
|
45
|
-
export { ylfCloudShapes, ylfCloudSilhouettes };
|
|
46
|
-
export type { BottomMenuItem, YlfAccentTone, YlfAgentState, YlfCloudShape, YlfColorAppearance, YlfSegmentedOption };
|
|
56
|
+
export { ylfCloudShapes, ylfCloudSilhouettes, ylfCuteCloudShapes };
|
|
57
|
+
export type { BottomMenuItem, YlfAccentTone, YlfAgentState, YlfCloudShape, YlfColorAppearance, YlfCuteCloudLook, YlfCuteCloudMood, YlfCuteCloudShape, YlfSegmentedOption };
|
package/dist/index.d.mts
CHANGED
|
@@ -28,6 +28,17 @@ type YlfCloudShape = typeof ylfCloudShapes[number];
|
|
|
28
28
|
/** Shared SVG paths for cloud silhouettes (`viewBox="0 0 490 250"`). */
|
|
29
29
|
declare const ylfCloudSilhouettes: Record<YlfCloudShape, string>;
|
|
30
30
|
|
|
31
|
+
/** Silhouettes supported by `YlfCuteCloud`. */
|
|
32
|
+
declare const ylfCuteCloudShapes: readonly ["round", "long", "small"];
|
|
33
|
+
type YlfCuteCloudShape = typeof ylfCuteCloudShapes[number];
|
|
34
|
+
type YlfCuteCloudMood = 'calm' | 'happy';
|
|
35
|
+
interface YlfCuteCloudLook {
|
|
36
|
+
/** Horizontal gaze direction, clamped to `-1..1`. */
|
|
37
|
+
x: number;
|
|
38
|
+
/** Vertical gaze direction, clamped to `-1..1`. */
|
|
39
|
+
y: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
31
42
|
/** One choice in a single-selection segmented control. */
|
|
32
43
|
interface YlfSegmentedOption<T extends string = string> {
|
|
33
44
|
value: T;
|
|
@@ -42,5 +53,5 @@ type YlfAccentTone = 'blue' | 'sun' | 'cyan' | 'coral' | 'pink' | 'green';
|
|
|
42
53
|
/** Visual emphasis for accent and status buttons/badges. */
|
|
43
54
|
type YlfColorAppearance = 'solid' | 'soft' | 'outline';
|
|
44
55
|
|
|
45
|
-
export { ylfCloudShapes, ylfCloudSilhouettes };
|
|
46
|
-
export type { BottomMenuItem, YlfAccentTone, YlfAgentState, YlfCloudShape, YlfColorAppearance, YlfSegmentedOption };
|
|
56
|
+
export { ylfCloudShapes, ylfCloudSilhouettes, ylfCuteCloudShapes };
|
|
57
|
+
export type { BottomMenuItem, YlfAccentTone, YlfAgentState, YlfCloudShape, YlfColorAppearance, YlfCuteCloudLook, YlfCuteCloudMood, YlfCuteCloudShape, YlfSegmentedOption };
|
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,17 @@ type YlfCloudShape = typeof ylfCloudShapes[number];
|
|
|
28
28
|
/** Shared SVG paths for cloud silhouettes (`viewBox="0 0 490 250"`). */
|
|
29
29
|
declare const ylfCloudSilhouettes: Record<YlfCloudShape, string>;
|
|
30
30
|
|
|
31
|
+
/** Silhouettes supported by `YlfCuteCloud`. */
|
|
32
|
+
declare const ylfCuteCloudShapes: readonly ["round", "long", "small"];
|
|
33
|
+
type YlfCuteCloudShape = typeof ylfCuteCloudShapes[number];
|
|
34
|
+
type YlfCuteCloudMood = 'calm' | 'happy';
|
|
35
|
+
interface YlfCuteCloudLook {
|
|
36
|
+
/** Horizontal gaze direction, clamped to `-1..1`. */
|
|
37
|
+
x: number;
|
|
38
|
+
/** Vertical gaze direction, clamped to `-1..1`. */
|
|
39
|
+
y: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
31
42
|
/** One choice in a single-selection segmented control. */
|
|
32
43
|
interface YlfSegmentedOption<T extends string = string> {
|
|
33
44
|
value: T;
|
|
@@ -42,5 +53,5 @@ type YlfAccentTone = 'blue' | 'sun' | 'cyan' | 'coral' | 'pink' | 'green';
|
|
|
42
53
|
/** Visual emphasis for accent and status buttons/badges. */
|
|
43
54
|
type YlfColorAppearance = 'solid' | 'soft' | 'outline';
|
|
44
55
|
|
|
45
|
-
export { ylfCloudShapes, ylfCloudSilhouettes };
|
|
46
|
-
export type { BottomMenuItem, YlfAccentTone, YlfAgentState, YlfCloudShape, YlfColorAppearance, YlfSegmentedOption };
|
|
56
|
+
export { ylfCloudShapes, ylfCloudSilhouettes, ylfCuteCloudShapes };
|
|
57
|
+
export type { BottomMenuItem, YlfAccentTone, YlfAgentState, YlfCloudShape, YlfColorAppearance, YlfCuteCloudLook, YlfCuteCloudMood, YlfCuteCloudShape, YlfSegmentedOption };
|
package/dist/index.mjs
CHANGED
|
@@ -18,4 +18,10 @@ const ylfCloudSilhouettes = {
|
|
|
18
18
|
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"
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
const ylfCuteCloudShapes = [
|
|
22
|
+
"round",
|
|
23
|
+
"long",
|
|
24
|
+
"small"
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
export { ylfCloudShapes, ylfCloudSilhouettes, ylfCuteCloudShapes };
|