@yunlefun/vue 0.4.1 → 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.
Files changed (76) hide show
  1. package/README.md +6 -0
  2. package/components/YlfAccordion.vue +12 -7
  3. package/components/YlfAgentCard.vue +108 -0
  4. package/components/YlfAgentStatus.vue +69 -0
  5. package/components/YlfAgentTask.vue +85 -0
  6. package/components/YlfButton.vue +145 -28
  7. package/components/YlfCard.vue +10 -4
  8. package/components/YlfCheckbox.vue +70 -7
  9. package/components/YlfCloud.vue +193 -0
  10. package/components/YlfDialog.vue +57 -22
  11. package/components/YlfDropdownMenu.vue +41 -5
  12. package/components/YlfInput.vue +67 -0
  13. package/components/YlfLogo.vue +7 -5
  14. package/components/YlfNavigation.vue +84 -0
  15. package/components/YlfNavigationLink.vue +59 -0
  16. package/components/YlfNavigationTrigger.vue +53 -0
  17. package/components/YlfPopover.vue +43 -7
  18. package/components/YlfRadioGroup.vue +41 -6
  19. package/components/YlfSegmentedControl.vue +80 -10
  20. package/components/YlfSelect.vue +43 -12
  21. package/components/YlfSlider.vue +16 -5
  22. package/components/YlfSwitch.vue +30 -4
  23. package/components/YlfTabs.vue +12 -4
  24. package/components/YlfTooltip.vue +29 -4
  25. package/components/_navigation.scss +38 -0
  26. package/components/accordion/demo.vue +1 -1
  27. package/components/agent-card/demo.vue +17 -0
  28. package/components/agent-card/index.md +25 -0
  29. package/components/agent-status/demo.vue +38 -0
  30. package/components/agent-status/index.md +20 -0
  31. package/components/agent-task/demo.vue +15 -0
  32. package/components/agent-task/index.md +25 -0
  33. package/components/agent.ts +2 -0
  34. package/components/button/demo.vue +21 -0
  35. package/components/button/index.md +20 -11
  36. package/components/cloud/demo.vue +92 -0
  37. package/components/cloud/index.md +66 -0
  38. package/components/cloud.ts +4 -0
  39. package/components/dialog/index.md +10 -7
  40. package/components/input/demo.vue +22 -0
  41. package/components/input/index.md +19 -0
  42. package/components/navigation/demo.vue +104 -0
  43. package/components/navigation/index.md +90 -0
  44. package/components/navigation-indicator.ts +114 -0
  45. package/dist/ag-ui.cjs +132 -0
  46. package/dist/ag-ui.d.cts +25 -0
  47. package/dist/ag-ui.d.mts +25 -0
  48. package/dist/ag-ui.d.ts +25 -0
  49. package/dist/ag-ui.mjs +130 -0
  50. package/dist/components/YlfAgentCard.vue.d.ts +24 -0
  51. package/dist/components/YlfAgentStatus.vue.d.ts +13 -0
  52. package/dist/components/YlfAgentTask.vue.d.ts +23 -0
  53. package/dist/components/YlfAvatar.vue.d.ts +1 -1
  54. package/dist/components/YlfButton.vue.d.ts +8 -5
  55. package/dist/components/YlfCloud.vue.d.ts +15 -0
  56. package/dist/components/YlfDialog.vue.d.ts +8 -5
  57. package/dist/components/YlfDropdownMenu.vue.d.ts +2 -2
  58. package/dist/components/YlfInput.vue.d.ts +18 -0
  59. package/dist/components/YlfNavigation.vue.d.ts +23 -0
  60. package/dist/components/YlfNavigationLink.vue.d.ts +21 -0
  61. package/dist/components/YlfNavigationTrigger.vue.d.ts +18 -0
  62. package/dist/components/YlfPopover.vue.d.ts +3 -3
  63. package/dist/components/YlfProgress.vue.d.ts +1 -1
  64. package/dist/components/YlfSeparator.vue.d.ts +2 -2
  65. package/dist/components/YlfSwitch.vue.d.ts +1 -1
  66. package/dist/components/YlfTabs.vue.d.ts +3 -3
  67. package/dist/components/YlfTooltip.vue.d.ts +3 -3
  68. package/dist/components/agent.d.ts +2 -0
  69. package/dist/components/cloud.d.ts +3 -0
  70. package/dist/components/navigation-indicator.d.ts +14 -0
  71. package/dist/index.cjs +3 -0
  72. package/dist/index.d.cts +9 -2
  73. package/dist/index.d.mts +9 -2
  74. package/dist/index.d.ts +9 -2
  75. package/dist/index.mjs +3 -1
  76. package/package.json +16 -6
@@ -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: transform var(--ylf-duration-normal, 240ms) var(--ylf-ease-bounce, cubic-bezier(0.34, 1.56, 0.64, 1));
98
- will-change: transform;
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>
@@ -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
- &:hover:not([data-disabled]) {
74
- color: var(--ylf-c-text, #0f172a);
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 0.25s var(--ylf-ease-bounce, cubic-bezier(0.34, 1.56, 0.64, 1)),
107
- width 0.25s ease;
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
- animation: ylf-tooltip-in 0.16s ease;
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='delayed-open'] {
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: '什么是 YunLeFun Design?', content: '云乐坊设计系统,统一设计规范、品牌视觉与 UI 实现;默认晴空蓝为主,高饱和纯色点缀。' },
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)。
@@ -0,0 +1,2 @@
1
+ /** Presentation states only; applications own connection and approval policies. */
2
+ export type YlfAgentState = 'offline' | 'connecting' | 'ready' | 'working' | 'waiting' | 'error' | 'unknown'
@@ -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
@@ -7,6 +7,12 @@ title_zh: 按钮
7
7
 
8
8
  状态按钮与徽标使用同一套多巴胺色板:成功为鲜绿、提醒为明黄、危险为珊瑚橙,文字使用配套的同色相深色 token。
9
9
 
10
+ ## 品牌入口
11
+
12
+ 首页或活动区的主入口使用 `variant="hero" size="xl"`:深蓝到青蓝渐变、白色文案、柔光投影,以及 56px 点击高度。明暗主题均保留深色渐变和白字,不使用偏亮的天空装饰渐变作为按钮底色。悬停时加深颜色,键盘聚焦使用双色外圈,减少动态效果时关闭位移。
13
+
14
+ 每个区块保留一个 hero 主入口。日常保存、确认和导航使用 `primary` 或次级变体。`tone` 和 `appearance` 不改变 hero 的专用配色;颜色与阴影统一由 `--ylf-hero-*` 提供,业务可保留自己的路由行为封装。
15
+
10
16
  ## Registry
11
17
 
12
18
  Button 可以通过 URL 将组件源码和共享品牌 token 复制进业务项目;命令、边界和发布验收见 [Registry 分发](/guide/registry)。稳定基础组件仍优先通过 `@yunlefun/vue` 使用。
@@ -17,17 +23,18 @@ Button 可以通过 URL 将组件源码和共享品牌 token 复制进业务项
17
23
 
18
24
  ## Props
19
25
 
20
- | 属性 | 说明 | 类型 | 默认值 |
21
- | ------------ | ----------------------------- | --------------------------------------------------------------------------------- | ---------- |
22
- | `variant` | 风格 | `primary \| accent \| secondary \| soft \| ghost \| success \| warning \| danger` | `primary` |
23
- | `tone` | 强调色,仅作用于 `accent` | `blue \| sun \| cyan \| coral \| pink \| green` | `blue` |
24
- | `appearance` | `accent` 与状态变体的强调程度 | `solid \| soft \| outline` | `solid` |
25
- | `size` | 尺寸 | `sm \| md \| lg` | `md` |
26
- | `round` | 胶囊圆角(云是软的) | `boolean` | `true` |
27
- | `block` | 占满整行宽度 | `boolean` | `false` |
28
- | `loading` | 加载态 | `boolean` | `false` |
29
- | `disabled` | 禁用 | `boolean` | `false` |
30
- | `tag` | 渲染标签,如 `'a'` | `string` | `'button'` |
26
+ | 属性 | 说明 | 类型 | 默认值 |
27
+ | ------------ | -------------------------------- | ----------------------------------------------------------------------------------------- | ---------- |
28
+ | `variant` | 风格 | `primary \| hero \| accent \| secondary \| soft \| ghost \| success \| warning \| danger` | `primary` |
29
+ | `tone` | 强调色,仅作用于 `accent` | `blue \| sun \| cyan \| coral \| pink \| green` | `blue` |
30
+ | `appearance` | `accent` 与状态变体的强调程度 | `solid \| soft \| outline` | `solid` |
31
+ | `size` | 尺寸 | `sm \| md \| lg \| xl` | `md` |
32
+ | `iconOnly` | 方形图标按钮,必须提供可访问名称 | `boolean` | `false` |
33
+ | `round` | 胶囊圆角(云是软的) | `boolean` | `true` |
34
+ | `block` | 占满整行宽度 | `boolean` | `false` |
35
+ | `loading` | 加载态 | `boolean` | `false` |
36
+ | `disabled` | 禁用 | `boolean` | `false` |
37
+ | `tag` | 渲染标签,如 `'a'` | `string` | `'button'` |
31
38
 
32
39
  `accent` 的 `tone` 可选 `blue | sun | cyan | coral | pink | green`,默认为 `blue`(晴空蓝)。其他变体保持自己的品牌或状态语义,不受 `tone` 影响。旧 `aurora` 值仍可接收,效果映射到 `accent`。
33
40
 
@@ -43,3 +50,5 @@ Button 可以通过 URL 将组件源码和共享品牌 token 复制进业务项
43
50
  | 名称 | 说明 |
44
51
  | ------- | --------------------------------------------- |
45
52
  | `click` | 点击时触发(`disabled` / `loading` 下不触发) |
53
+
54
+ 纯图标按钮尺寸为 32px(`sm`)、36px(`md`)、44px(`lg` / `xl`),粗指针下点击区域至少 44px。提供 `aria-label`,并组合 `YlfTooltip` 展示提示。默认 `type="button"`,提交表单时显式传入 `type="submit"`。
@@ -0,0 +1,92 @@
1
+ <script setup lang="ts">
2
+ import type { YlfCloudShape } from '../cloud'
3
+ import { computed, ref, useId } from 'vue'
4
+
5
+ const shape = ref<YlfCloudShape>('billow')
6
+ const haze = ref([0])
7
+ const volumetric = ref(true)
8
+ const face = ref(false)
9
+ const volumetricId = useId()
10
+ const faceId = useId()
11
+
12
+ const shapes: { value: YlfCloudShape, label: string }[] = [
13
+ { value: 'billow', label: '积云' },
14
+ { value: 'heap', label: '堆云' },
15
+ { value: 'bank', label: '云堤' },
16
+ { value: 'puff', label: '团云' },
17
+ { value: 'wisp', label: '薄云' },
18
+ ]
19
+ const hazeValue = computed(() => haze.value[0] / 100)
20
+ </script>
21
+
22
+ <template>
23
+ <div class="flex flex-col gap-5">
24
+ <div class="cloud-demo__sky">
25
+ <!-- 远处的云混入天空色,近处保持清晰:同一组件靠 --ylf-cloud-haze 拉开层次。 -->
26
+ <YlfCloud shape="wisp" class="cloud-demo__far" style="--ylf-cloud-haze: 0.7" />
27
+ <YlfCloud shape="bank" class="cloud-demo__mid" style="--ylf-cloud-haze: 0.4" />
28
+ <YlfCloud
29
+ :shape="shape"
30
+ :volumetric="volumetric"
31
+ :face="face"
32
+ class="cloud-demo__near"
33
+ :style="{ '--ylf-cloud-haze': hazeValue, '--ylf-cloud-face-opacity': face ? 0.85 : 0 }"
34
+ />
35
+ </div>
36
+ <YlfSegmentedControl v-model="shape" :options="shapes" label="云朵形状" />
37
+ <div class="flex flex-col gap-2">
38
+ <YlfSlider v-model="haze" label="空气透视" />
39
+ <p class="m-0 text-sm op-70">
40
+ --ylf-cloud-haze:{{ hazeValue.toFixed(2) }}
41
+ </p>
42
+ </div>
43
+ <div class="flex flex-wrap items-center gap-6">
44
+ <label class="flex items-center gap-2 text-sm" :for="volumetricId">
45
+ <YlfSwitch :id="volumetricId" v-model="volumetric" size="sm" />
46
+ 体积光
47
+ </label>
48
+ <label class="flex items-center gap-2 text-sm" :for="faceId">
49
+ <YlfSwitch :id="faceId" v-model="face" size="sm" />
50
+ 小脸
51
+ </label>
52
+ </div>
53
+ </div>
54
+ </template>
55
+
56
+ <style scoped>
57
+ .cloud-demo__sky {
58
+ position: relative;
59
+ height: 220px;
60
+ overflow: hidden;
61
+ border-radius: var(--ylf-radius-lg);
62
+ background: linear-gradient(180deg, var(--ylf-c-sky), var(--ylf-cloud-haze-color));
63
+ }
64
+
65
+ .cloud-demo__sky > * {
66
+ position: absolute;
67
+ }
68
+
69
+ .cloud-demo__far {
70
+ top: 8%;
71
+ right: -6%;
72
+ width: 46%;
73
+ }
74
+
75
+ .cloud-demo__mid {
76
+ bottom: -8%;
77
+ left: -8%;
78
+ width: 62%;
79
+ }
80
+
81
+ .cloud-demo__near {
82
+ bottom: 0;
83
+ left: 50%;
84
+ width: min(380px, 70%);
85
+ translate: -50% 0;
86
+ transition: translate var(--ylf-duration-slow) var(--ylf-ease-spring);
87
+ }
88
+
89
+ .cloud-demo__near:hover {
90
+ translate: -50% -6px;
91
+ }
92
+ </style>
@@ -0,0 +1,66 @@
1
+ ---
2
+ title: Cloud
3
+ title_zh: 云朵
4
+ ---
5
+
6
+ 云乐坊各站点共用的云朵插画:五种轮廓、左上方来光、顶部逆光描边与空气透视,配色来自 `@yunlefun/ui` 的 `--ylf-cloud-*` token,随明暗主题切换。纯装饰,`aria-hidden="true"`,不接收指针事件。
7
+
8
+ ## 选择轮廓
9
+
10
+ 画布统一为 `490 × 250`,轮廓都是一条连续曲线,缩放或翻转后不会露出圆形拼接。同一画面中混用不同轮廓,避免重复。
11
+
12
+ - `billow`:层层鼓起的主云,适合视觉焦点。
13
+ - `heap`:宽厚的近景积云,右侧更高。
14
+ - `bank`:贴着地平线的扁长云堤。
15
+ - `puff`:圆鼓鼓的小团云,适合空状态或吉祥物。
16
+ - `wisp`:远处拉长的薄云。
17
+
18
+ ## 层次与性能
19
+
20
+ 用 `--ylf-cloud-haze`(0–1)表达远近:数值越大,云体、阴影越接近 `--ylf-cloud-haze-color`,底部阴影和逆光描边同步减弱。把它写在组件或父元素上即可。
21
+
22
+ `volumetric` 用高斯模糊塑造亮面体积,只给一两朵焦点云开启;其余云使用渐变近似,降低绘制开销。
23
+
24
+ ## 小脸与动效
25
+
26
+ `face` 只渲染一张默认隐藏的小脸,由宿主设置 `--ylf-cloud-face-opacity` 唤醒,例如悬停、聚焦或被戳之后设为 `0.85`;淡入使用 `--ylf-duration-slow`。眼睛偶尔眨一下。
27
+
28
+ 组件本身不移动。漂浮、入场、被戳回弹由宿主添加,软的位移使用 `--ylf-ease-spring` 与 `--ylf-duration-slow`,颜色与透明度使用 `--ylf-ease-standard`。开启“减少动态效果”时,这些时长归零,眨眼停止;宿主自己的循环动画也要处理该偏好。
29
+
30
+ ## Props
31
+
32
+ | 属性 | 说明 | 类型 | 默认值 |
33
+ | ------------ | ------------------------------- | ---------------------------------------- | -------- |
34
+ | `shape` | 云朵轮廓 | `billow \| heap \| bank \| puff \| wisp` | `billow` |
35
+ | `volumetric` | 用模糊滤镜塑造亮面体积 | `boolean` | `false` |
36
+ | `face` | 渲染隐藏的小脸,由 CSS 变量唤醒 | `boolean` | `false` |
37
+
38
+ ## CSS 变量
39
+
40
+ | 变量 | 说明 | 默认值(浅色 / 深色) |
41
+ | -------------------------- | ---------------------------------- | --------------------- |
42
+ | `--ylf-cloud-haze` | 空气透视强度,0 为近景,1 融入天空 | `0` |
43
+ | `--ylf-cloud-haze-color` | 远处云融入的天空色 | `#9cc6ef` / `#1f3354` |
44
+ | `--ylf-cloud-face-opacity` | 小脸透明度 | `0` |
45
+ | `--ylf-cloud-highlight` | 亮面 | `#fffefa` / `#a6bcd8` |
46
+ | `--ylf-cloud-body` | 云体 | `#f2f8ff` / `#3e5679` |
47
+ | `--ylf-cloud-shade` | 背光面 | `#c6dff5` / `#1c2b44` |
48
+ | `--ylf-cloud-shadow` | 底部阴影 | `#83addb` / `#0a1424` |
49
+ | `--ylf-cloud-rim` | 顶部逆光描边 | `#ffffff` / `#cfdff2` |
50
+ | `--ylf-cloud-face` | 小脸颜色 | `#5a7fae` / `#0e1a2d` |
51
+
52
+ 深色主题默认是月光下的夜空蓝。站点有自己的天空时,在天空容器上覆盖这组 token,例如黄昏:
53
+
54
+ ```css
55
+ .dark .my-sky {
56
+ --ylf-cloud-highlight: #fff0e7;
57
+ --ylf-cloud-body: #e8d7ed;
58
+ --ylf-cloud-shade: #b6a5d0;
59
+ --ylf-cloud-shadow: #8377ad;
60
+ --ylf-cloud-rim: #ffd9c4;
61
+ --ylf-cloud-face: #6d5a92;
62
+ --ylf-cloud-haze-color: #a48cc4;
63
+ }
64
+ ```
65
+
66
+ 轮廓列表也可从包根入口取得:`import { ylfCloudShapes } from '@yunlefun/vue'`,类型为 `YlfCloudShape`。token 随 `@yunlefun/ui` 0.0.7 发布;未加载共享样式时组件回退到浅色配色。
@@ -0,0 +1,4 @@
1
+ /** Silhouettes of the shared cloud illustration, from a tall billow to a thin distant wisp. */
2
+ export const ylfCloudShapes = ['billow', 'heap', 'bank', 'puff', 'wisp'] as const
3
+
4
+ export type YlfCloudShape = typeof ylfCloudShapes[number]
@@ -7,13 +7,16 @@ title_zh: 对话框
7
7
 
8
8
  ## Props
9
9
 
10
- | 属性 | 说明 | 类型 | 默认值 |
11
- | ----------------- | -------------------------------- | ----------------------- | ----------------------- |
12
- | `v-model:open` | 显隐状态 | `boolean` | `false` |
13
- | `title` | 可见标题 | `string` | — |
14
- | `description` | 描述 | `string` | — |
15
- | `accessibleTitle` | 无可见标题时供辅助技术读取的标题 | `string` | `'对话框'` |
16
- | `portalTo` | 已存在的主题内浮层容器 | `string \| HTMLElement` | ConfigProvider / `body` |
10
+ | 属性 | 说明 | 类型 | 默认值 |
11
+ | ----------------- | ---------------------------------- | ----------------------- | ----------------------- |
12
+ | `v-model:open` | 显隐状态 | `boolean` | `false` |
13
+ | `title` | 可见标题 | `string` | — |
14
+ | `description` | 描述 | `string` | — |
15
+ | `accessibleTitle` | 无可见标题时供辅助技术读取的标题 | `string` | `'对话框'` |
16
+ | `closeLabel` | 关闭按钮的无障碍名称,可随正文翻译 | `string` | `'关闭'` |
17
+ | `portalTo` | 已存在的主题内浮层容器 | `string \| HTMLElement` | ConfigProvider / `body` |
18
+
19
+ 英文界面可设置 `close-label="Close"`,让关闭按钮与正文语言一致。
17
20
 
18
21
  建议始终提供 `title`。只有视觉设计明确隐藏标题时,才改用描述场景的 `accessible-title`。
19
22
 
@@ -0,0 +1,22 @@
1
+ <script setup lang="ts">
2
+ import { ref, useId } from 'vue'
3
+
4
+ const name = ref('')
5
+ const id = useId()
6
+ </script>
7
+
8
+ <template>
9
+ <div class="grid max-w-sm w-full gap-4">
10
+ <label :for="id" class="grid gap-2">
11
+ 名称
12
+ <YlfInput :id="id" v-model="name" name="name" autocomplete="name" placeholder="输入名称" />
13
+ </label>
14
+ <YlfInput size="sm" aria-label="紧凑输入" placeholder="紧凑输入" />
15
+ <YlfInput model-value="只读内容" aria-label="只读内容" readonly />
16
+ <YlfInput model-value="暂不可用" aria-label="暂不可用" disabled />
17
+ <div class="grid gap-2">
18
+ <YlfInput invalid aria-label="名称" :aria-describedby="`${id}-error`" />
19
+ <span :id="`${id}-error`" class="text-sm text-[var(--ylf-status-danger-text)]">请输入名称。</span>
20
+ </div>
21
+ </div>
22
+ </template>