@opentiny/tiny-robot 0.1.0 → 0.2.0-alpha.1

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 (150) hide show
  1. package/dist/action-group/ActionGroup.vue.d.ts +26 -0
  2. package/dist/action-group/ActionGroupItem.vue.d.ts +18 -0
  3. package/dist/action-group/index.d.ts +12 -0
  4. package/dist/action-group/index.type.d.ts +16 -0
  5. package/dist/bubble/index.type.d.ts +1 -1
  6. package/dist/container/index.d.ts +7 -0
  7. package/dist/container/index.type.d.ts +16 -0
  8. package/dist/container/index.vue.d.ts +26 -0
  9. package/dist/feedback/components/SourceList.vue.d.ts +11 -0
  10. package/dist/feedback/components/index.d.ts +1 -0
  11. package/dist/feedback/index.d.ts +7 -0
  12. package/dist/feedback/index.type.d.ts +25 -0
  13. package/dist/feedback/index.vue.d.ts +13 -0
  14. package/dist/history/components/index.d.ts +2 -0
  15. package/dist/history/components/item-tag.vue.d.ts +5 -0
  16. package/dist/history/components/search-empty.vue.d.ts +7 -0
  17. package/dist/history/composables/index.d.ts +1 -0
  18. package/dist/history/composables/useEditItemTitle.d.ts +12 -0
  19. package/dist/history/index.d.ts +6 -0
  20. package/dist/history/index.type.d.ts +43 -0
  21. package/dist/history/index.vue.d.ts +2 -0
  22. package/dist/icon-button/index.d.ts +7 -0
  23. package/dist/icon-button/index.type.d.ts +7 -0
  24. package/dist/icon-button/index.vue.d.ts +6 -0
  25. package/dist/index.d.ts +12 -2
  26. package/dist/index.js +56 -22
  27. package/dist/node_modules/.pnpm/@opentiny_utils@3.22.0/node_modules/@opentiny/utils/dist/index.es.js +1335 -884
  28. package/dist/node_modules/.pnpm/@opentiny_vue-common@3.22.0/node_modules/@opentiny/vue-common/lib/index.js +660 -144
  29. package/dist/node_modules/.pnpm/@opentiny_vue-hooks@3.22.0/node_modules/@opentiny/vue-hooks/dist/src/vue-popper.js +85 -0
  30. package/dist/node_modules/.pnpm/@opentiny_vue-locale@3.22.0/node_modules/@opentiny/vue-locale/lib/index.js +1783 -0
  31. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.22.0/node_modules/@opentiny/vue-renderless/tooltip/index.js +77 -0
  32. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.22.0/node_modules/@opentiny/vue-renderless/tooltip/vue.js +90 -0
  33. package/dist/node_modules/.pnpm/@opentiny_vue-tooltip@3.22.0/node_modules/@opentiny/vue-tooltip/lib/index.js +176 -0
  34. package/dist/node_modules/.pnpm/@opentiny_vue-tooltip@3.22.0/node_modules/@opentiny/vue-tooltip/lib/pc.js +248 -0
  35. package/dist/node_modules/.pnpm/@vueuse_core@13.1.0_vue@3.5.13/node_modules/@vueuse/core/index.js +190 -0
  36. package/dist/node_modules/.pnpm/@vueuse_shared@13.1.0_vue@3.5.13/node_modules/@vueuse/shared/index.js +53 -0
  37. package/dist/packages/components/src/action-group/ActionGroup.vue.js +7 -0
  38. package/dist/packages/components/src/action-group/ActionGroup.vue2.js +97 -0
  39. package/dist/packages/components/src/action-group/ActionGroupItem.vue.js +14 -0
  40. package/dist/packages/components/src/action-group/ActionGroupItem.vue2.js +4 -0
  41. package/dist/packages/components/src/action-group/index.js +17 -0
  42. package/dist/packages/components/src/bubble/bubble-list.vue.js +2 -2
  43. package/dist/packages/components/src/bubble/bubble-list.vue2.js +18 -19
  44. package/dist/packages/components/src/bubble/bubble.vue.js +2 -2
  45. package/dist/packages/components/src/bubble/bubble.vue2.js +46 -46
  46. package/dist/packages/components/src/container/index.js +9 -0
  47. package/dist/packages/components/src/container/index.vue.js +7 -0
  48. package/dist/packages/components/src/container/index.vue2.js +55 -0
  49. package/dist/packages/components/src/feedback/components/SourceList.vue.js +7 -0
  50. package/dist/packages/components/src/feedback/components/SourceList.vue2.js +52 -0
  51. package/dist/packages/components/src/feedback/index.js +9 -0
  52. package/dist/packages/components/src/feedback/index.vue.js +7 -0
  53. package/dist/packages/components/src/feedback/index.vue2.js +142 -0
  54. package/dist/packages/components/src/history/components/item-tag.vue.js +7 -0
  55. package/dist/packages/components/src/history/components/item-tag.vue2.js +21 -0
  56. package/dist/packages/components/src/history/components/search-empty.vue.js +7 -0
  57. package/dist/packages/components/src/history/components/search-empty.vue2.js +20 -0
  58. package/dist/packages/components/src/history/composables/useEditItemTitle.js +43 -0
  59. package/dist/packages/components/src/history/index.js +11 -0
  60. package/dist/packages/components/src/history/index.vue.js +7 -0
  61. package/dist/packages/components/src/history/index.vue2.js +130 -0
  62. package/dist/packages/components/src/icon-button/index.js +9 -0
  63. package/dist/packages/components/src/icon-button/index.vue.js +7 -0
  64. package/dist/packages/components/src/icon-button/index.vue2.js +40 -0
  65. package/dist/packages/components/src/prompts/prompt.vue.js +2 -2
  66. package/dist/packages/components/src/prompts/prompt.vue2.js +17 -15
  67. package/dist/packages/components/src/question/components/HotQuestions.vue.js +22 -22
  68. package/dist/packages/components/src/question/index.vue.js +7 -7
  69. package/dist/packages/components/src/sender/components/TemplateEditor.vue.js +7 -0
  70. package/dist/packages/components/src/sender/components/TemplateEditor.vue2.js +121 -0
  71. package/dist/packages/components/src/sender/index.vue.js +149 -128
  72. package/dist/packages/components/src/suggestion/components/CategoryNav.vue.js +38 -0
  73. package/dist/packages/components/src/suggestion/components/CategoryNav.vue2.js +4 -0
  74. package/dist/packages/components/src/suggestion/components/SuggestionCapsule.vue.js +107 -0
  75. package/dist/packages/components/src/suggestion/components/SuggestionCapsule.vue2.js +4 -0
  76. package/dist/packages/components/src/suggestion/components/SuggestionPanel.vue.js +123 -0
  77. package/dist/packages/components/src/suggestion/components/SuggestionPanel.vue2.js +4 -0
  78. package/dist/packages/components/src/suggestion/composables/useKeyboardNavigation.js +45 -0
  79. package/dist/packages/components/src/suggestion/composables/useTriggerDetection.js +17 -0
  80. package/dist/packages/components/src/suggestion/index.js +9 -0
  81. package/dist/packages/components/src/suggestion/index.vue.js +179 -0
  82. package/dist/packages/components/src/suggestion/index.vue2.js +4 -0
  83. package/dist/packages/components/src/suggestion/utils/dom.js +18 -0
  84. package/dist/packages/svgs/dist/tiny-robot-svgs.js +364 -69
  85. package/dist/question/components/HotQuestions.vue.d.ts +2 -2
  86. package/dist/question/index.vue.d.ts +1 -1
  87. package/dist/sender/components/ActionButtons.vue.d.ts +2 -2
  88. package/dist/sender/components/TemplateEditor.vue.d.ts +18 -0
  89. package/dist/sender/index.type.d.ts +47 -0
  90. package/dist/sender/index.vue.d.ts +70 -5
  91. package/dist/style.css +1 -1
  92. package/dist/suggestion/components/CategoryNav.vue.d.ts +45 -0
  93. package/dist/suggestion/components/SuggestionCapsule.vue.d.ts +32 -0
  94. package/dist/suggestion/components/SuggestionPanel.vue.d.ts +84 -0
  95. package/dist/suggestion/composables/useKeyboardNavigation.d.ts +18 -0
  96. package/dist/suggestion/composables/useSuggestionFilter.d.ts +10 -0
  97. package/dist/suggestion/composables/useTriggerDetection.d.ts +11 -0
  98. package/dist/suggestion/index.d.ts +7 -0
  99. package/dist/suggestion/index.type.d.ts +94 -0
  100. package/dist/suggestion/index.vue.d.ts +343 -0
  101. package/dist/suggestion/utils/dom.d.ts +20 -0
  102. package/package.json +5 -5
  103. package/src/action-group/ActionGroup.vue +232 -0
  104. package/src/action-group/ActionGroupItem.vue +9 -0
  105. package/src/action-group/index.ts +25 -0
  106. package/src/action-group/index.type.ts +20 -0
  107. package/src/bubble/bubble-list.vue +1 -3
  108. package/src/bubble/bubble.vue +4 -14
  109. package/src/bubble/index.type.ts +1 -1
  110. package/src/container/index.ts +12 -0
  111. package/src/container/index.type.ts +17 -0
  112. package/src/container/index.vue +134 -0
  113. package/src/feedback/components/SourceList.vue +112 -0
  114. package/src/feedback/components/index.ts +1 -0
  115. package/src/feedback/index.ts +12 -0
  116. package/src/feedback/index.type.ts +27 -0
  117. package/src/feedback/index.vue +166 -0
  118. package/src/history/components/index.ts +2 -0
  119. package/src/history/components/item-tag.vue +49 -0
  120. package/src/history/components/search-empty.vue +38 -0
  121. package/src/history/composables/index.ts +1 -0
  122. package/src/history/composables/useEditItemTitle.ts +75 -0
  123. package/src/history/index.ts +12 -0
  124. package/src/history/index.type.ts +50 -0
  125. package/src/history/index.vue +292 -0
  126. package/src/icon-button/index.ts +12 -0
  127. package/src/icon-button/index.type.ts +8 -0
  128. package/src/icon-button/index.vue +52 -0
  129. package/src/index.ts +37 -2
  130. package/src/prompts/prompt.vue +7 -21
  131. package/src/question/components/HotQuestions.vue +1 -1
  132. package/src/question/index.less +9 -10
  133. package/src/sender/components/TemplateEditor.vue +274 -0
  134. package/src/sender/index.less +17 -7
  135. package/src/sender/index.type.ts +51 -0
  136. package/src/sender/index.vue +56 -8
  137. package/src/sender/vars.less +3 -3
  138. package/src/suggestion/components/CategoryNav.vue +38 -0
  139. package/src/suggestion/components/SuggestionCapsule.vue +183 -0
  140. package/src/suggestion/components/SuggestionPanel.vue +147 -0
  141. package/src/suggestion/composables/useKeyboardNavigation.ts +101 -0
  142. package/src/suggestion/composables/useSuggestionFilter.ts +34 -0
  143. package/src/suggestion/composables/useTriggerDetection.ts +46 -0
  144. package/src/suggestion/index.less +497 -0
  145. package/src/suggestion/index.ts +12 -0
  146. package/src/suggestion/index.type.ts +101 -0
  147. package/src/suggestion/index.vue +338 -0
  148. package/src/suggestion/utils/dom.ts +66 -0
  149. package/src/suggestion/vars.less +141 -0
  150. package/.vscode/extensions.json +0 -3
@@ -0,0 +1,497 @@
1
+ @import './vars.less';
2
+
3
+ /**
4
+ * TR Suggestion 组件样式
5
+ */
6
+
7
+ /* ================ 基础容器样式 ================ */
8
+ .tr-suggestion {
9
+ position: relative;
10
+ display: inline-block;
11
+ width: 100%;
12
+
13
+ &.block-mode {
14
+ display: block;
15
+ width: 100%;
16
+ }
17
+
18
+ &__header {
19
+ display: flex;
20
+ align-items: center;
21
+ }
22
+
23
+ &-header-left {
24
+ display: flex;
25
+ align-items: center;
26
+ }
27
+
28
+ &__expand-button {
29
+ position: absolute;
30
+ right: 0;
31
+ z-index: 10;
32
+ cursor: pointer;
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: center;
36
+ width: 26px;
37
+ height: 26px;
38
+
39
+ /* 按钮图标 */
40
+ & > svg {
41
+ font-size: 26px;
42
+ fill: #ffffff;
43
+ }
44
+
45
+ & > svg:hover {
46
+ fill: #f5f5f5;
47
+ }
48
+ }
49
+
50
+ &__trigger {
51
+ background-color: #fff;
52
+ border-radius: 50%;
53
+ width: 32px;
54
+ height: 32px;
55
+ margin-right: 8px;
56
+ cursor: pointer;
57
+ display: flex;
58
+ justify-content: center;
59
+
60
+ & > svg {
61
+ font-size: 28px;
62
+ }
63
+ }
64
+
65
+ &__trigger:hover {
66
+ transform: scale(1.05);
67
+ background-color: #f5f5f5;
68
+ }
69
+
70
+ &.theme-dark {
71
+ --tr-suggestion-modal-background-color: var(--tr-suggestion-dark-bg, #1e1e1e);
72
+ --tr-suggestion-text-color: var(--tr-suggestion-dark-text, #e0e0e0);
73
+ --tr-suggestion-border-color: var(--tr-suggestion-dark-border, #3a3a3a);
74
+ --tr-suggestion-hover-color: var(--tr-suggestion-dark-hover-bg, #2a2a2a);
75
+ --tr-suggestion-item-extra-color: var(--tr-suggestion-dark-item-extra-color, #aaaaaa);
76
+ }
77
+ }
78
+
79
+ /**
80
+ * 指令弹窗面板
81
+ * 包含标题、分类标签和指令列表
82
+ */
83
+ .tr-suggestion-panel {
84
+ position: absolute;
85
+ border: none;
86
+ border-radius: var(--tr-suggestion-border-radius);
87
+ padding: var(--tr-suggestion-modal-padding);
88
+ box-shadow: var(--tr-suggestion-panel-shadow);
89
+ background-color: var(--tr-suggestion-modal-background-color);
90
+ max-height: var(--tr-suggestion-modal-max-height);
91
+ width: 100%;
92
+ max-width: 600px;
93
+ display: flex;
94
+ flex-direction: column;
95
+ overflow: hidden;
96
+ box-sizing: border-box;
97
+ z-index: var(--tr-suggestion-z-index);
98
+
99
+ /* 位置:显示在输入框下方 */
100
+ &.placement-bottom {
101
+ top: 100%;
102
+ left: 0;
103
+ margin-top: 8px;
104
+ }
105
+
106
+ /* 位置:显示在输入框上方 */
107
+ &.placement-top {
108
+ bottom: 100%;
109
+ left: 0;
110
+ margin-bottom: 8px;
111
+ }
112
+ }
113
+
114
+ /**
115
+ * 弹窗标题栏
116
+ * 包含标题文本和关闭按钮
117
+ */
118
+ .tr-suggestion-header {
119
+ display: flex;
120
+ justify-content: space-between;
121
+ align-items: center;
122
+ margin-bottom: 7px;
123
+
124
+ /* 标题文本 */
125
+ &-title {
126
+ font-size: var(--tr-suggestion-title-font-size);
127
+ font-weight: var(--tr-suggestion-title-font-weight);
128
+ color: var(--tr-suggestion-title-color);
129
+ }
130
+
131
+ /* 关闭按钮 */
132
+ .tr-suggestion-close-btn {
133
+ cursor: pointer;
134
+ display: flex;
135
+ align-items: center;
136
+ justify-content: center;
137
+ color: var(--tr-suggestion-close-icon-color);
138
+ transition: var(--tr-suggestion-hover-transition);
139
+
140
+ .close-icon {
141
+ font-size: 18px;
142
+ line-height: 1;
143
+ }
144
+
145
+ &:hover {
146
+ color: var(--tr-suggestion-text-color);
147
+ }
148
+ }
149
+ }
150
+
151
+ /* ================ 分类标签样式 ================ */
152
+ /**
153
+ * 分类标签容器
154
+ * 水平展示指令分类,支持点击切换,自适应屏幕宽度并支持换行
155
+ */
156
+ .tr-suggestion-categories {
157
+ display: flex;
158
+ flex-wrap: wrap;
159
+ gap: 8px;
160
+
161
+ /**
162
+ * 单个分类标签
163
+ * 支持悬停和激活状态样式
164
+ */
165
+ &-item {
166
+ box-sizing: border-box;
167
+ border-radius: var(--tr-suggestion-category-border-radius);
168
+ background: var(--tr-suggestion-category-bg);
169
+ border: 1px solid transparent;
170
+ height: var(--tr-suggestion-category-height);
171
+ padding: 10px 16px;
172
+ color: var(--tr-suggestion-tab-text);
173
+ transition: var(--tr-suggestion-hover-transition);
174
+ display: flex;
175
+ align-items: center;
176
+ gap: 4px;
177
+
178
+ /* 分类图标 */
179
+ .category-icon {
180
+ font-size: var(--tr-suggestion-icon-size);
181
+ margin-right: 4px;
182
+ }
183
+
184
+ /* 悬停效果 */
185
+ &:hover {
186
+ cursor: pointer;
187
+ background: var(--tr-suggestion-category-hover-bg);
188
+ }
189
+
190
+ /* 激活状态 */
191
+ &.active {
192
+ background: var(--tr-suggestion-common-bg) !important;
193
+ border: 1px solid var(--tr-suggestion-category-active-border) !important;
194
+ color: var(--tr-suggestion-text-color);
195
+ font-weight: 500;
196
+ }
197
+ }
198
+ }
199
+
200
+ /* ================ 指令列表样式 ================ */
201
+ /**
202
+ * 指令内容区
203
+ * 包含指令列表,支持滚动
204
+ */
205
+ .tr-suggestion-content {
206
+ flex: 1;
207
+ max-height: var(--tr-suggestion-content-max-height);
208
+ overflow-y: auto;
209
+ overscroll-behavior: contain;
210
+ position: relative;
211
+ padding: 10px 2px;
212
+ border-radius: var(--tr-suggestion-list-border-radius);
213
+
214
+ /**
215
+ * 自定义滚动条样式
216
+ */
217
+ &::-webkit-scrollbar {
218
+ width: var(--tr-suggestion-scrollbar-width);
219
+ height: 10px;
220
+ }
221
+
222
+ &::-webkit-scrollbar-track {
223
+ background: var(--tr-suggestion-scrollbar-track-bg);
224
+ border-radius: var(--tr-suggestion-scrollbar-border-radius);
225
+ }
226
+
227
+ &::-webkit-scrollbar-thumb {
228
+ background-color: var(--tr-suggestion-scrollbar-thumb-bg);
229
+ border-radius: var(--tr-suggestion-scrollbar-border-radius);
230
+ transition: background-color var(--tr-suggestion-transition-duration);
231
+ }
232
+
233
+ &::-webkit-scrollbar-thumb:hover {
234
+ background-color: var(--tr-suggestion-scrollbar-thumb-hover-bg);
235
+ }
236
+
237
+ /**
238
+ * 指令列表
239
+ */
240
+ & > ul {
241
+ list-style: none;
242
+ padding: 0;
243
+ margin: 0;
244
+
245
+ /**
246
+ * 指令项
247
+ * 支持悬停效果和溢出文本处理
248
+ */
249
+ .tr-suggestion-list-item {
250
+ color: var(--tr-suggestion-common-text);
251
+ font-size: var(--tr-suggestion-font-size);
252
+ font-weight: var(--tr-suggestion-item-font-weight);
253
+ text-align: left;
254
+ height: var(--tr-suggestion-item-height);
255
+ border-radius: var(--tr-suggestion-list-border-radius);
256
+ background: var(--tr-suggestion-list-item-bg);
257
+ cursor: pointer;
258
+ margin: 0;
259
+ white-space: nowrap;
260
+ overflow: hidden;
261
+ text-overflow: ellipsis;
262
+ display: flex;
263
+ align-items: center;
264
+ transition: var(--tr-suggestion-hover-transition);
265
+ border-left: 3px solid transparent;
266
+ position: relative;
267
+
268
+ &:hover {
269
+ border-radius: 12px;
270
+ background-color: #ffffff;
271
+ box-shadow: 0px 4px 16px 0px var(--tr-suggestion-list-hover-shadow);
272
+ z-index: 2;
273
+
274
+ &::after {
275
+ display: none;
276
+ }
277
+ }
278
+
279
+ /* 激活状态 - 键盘导航选中项 */
280
+ &.tr-suggestion-item-active {
281
+ border-radius: 12px;
282
+ background-color: #ffffff;
283
+ box-shadow: 0px 4px 16px 0px var(--tr-suggestion-list-hover-shadow);
284
+ z-index: 2;
285
+
286
+ &::after {
287
+ display: none;
288
+ }
289
+ }
290
+
291
+ .item-content {
292
+ flex: 1;
293
+ display: flex;
294
+ flex-direction: column;
295
+ gap: 4px;
296
+ min-width: 0;
297
+ justify-content: space-between;
298
+ padding: 16px;
299
+ }
300
+
301
+ .item-label {
302
+ font-weight: var(--tr-suggestion-item-font-weight);
303
+ white-space: nowrap;
304
+ overflow: hidden;
305
+ text-overflow: ellipsis;
306
+ color: var(--tr-suggestion-common-text);
307
+ }
308
+
309
+ .item-description {
310
+ font-size: var(--tr-suggestion-item-extra-font-size);
311
+ font-weight: 400;
312
+ white-space: nowrap;
313
+ overflow: hidden;
314
+ text-overflow: ellipsis;
315
+ color: var(--tr-suggestion-item-extra-color);
316
+ margin-top: 3px;
317
+ }
318
+
319
+ &::after {
320
+ content: '';
321
+ position: absolute;
322
+ bottom: 0;
323
+ left: 16px;
324
+ right: 16px;
325
+ height: 1px; /* 边框厚度 */
326
+ background-color: #f0f0f0; /* 边框颜色 */
327
+ }
328
+ }
329
+ }
330
+
331
+ /**
332
+ * 加载状态
333
+ */
334
+ .tr-suggestion-loading {
335
+ display: flex;
336
+ justify-content: center;
337
+ align-items: center;
338
+ height: 100px;
339
+
340
+ .tr-suggestion-loading-spinner {
341
+ width: 30px;
342
+ height: 30px;
343
+ border: 3px solid rgba(0, 0, 0, 0.1);
344
+ border-radius: 50%;
345
+ border-top-color: var(--tr-suggestion-primary-color);
346
+ animation: tr-suggestion-spin 1s ease-in-out infinite;
347
+ }
348
+
349
+ @keyframes tr-suggestion-spin {
350
+ to {
351
+ transform: rotate(360deg);
352
+ }
353
+ }
354
+ }
355
+
356
+ /**
357
+ * 空状态
358
+ */
359
+ .tr-suggestion-empty {
360
+ padding: var(--tr-suggestion-spacing);
361
+ color: var(--tr-suggestion-text-color-secondary);
362
+ text-align: center;
363
+ font-size: var(--tr-suggestion-font-size);
364
+
365
+ p {
366
+ margin: 0;
367
+ opacity: 0.7;
368
+ }
369
+ }
370
+ }
371
+
372
+ /* ================ 胶囊式指令样式 ================ */
373
+ /**
374
+ * 胶囊式指令容器
375
+ * 横向展示胶囊式指令
376
+ */
377
+ .tr-common-suggestions {
378
+ display: flex;
379
+ flex: 1;
380
+ position: relative;
381
+ width: 90%;
382
+
383
+ &_content {
384
+ display: flex;
385
+ flex-direction: column;
386
+ width: 100%;
387
+ }
388
+
389
+ /* 展开后的胶囊外层容器 - 使用绝对定位脱离文档流 */
390
+ &_expanded-wrapper {
391
+ position: absolute;
392
+ bottom: 100%;
393
+ left: 0;
394
+ width: 100%;
395
+ z-index: 10;
396
+ }
397
+
398
+ &_expanded-area {
399
+ display: flex;
400
+ flex-direction: column-reverse;
401
+ border-radius: 8px;
402
+ animation: fadeInUp 0.2s ease-out;
403
+ }
404
+
405
+ &_row {
406
+ display: flex;
407
+ flex-wrap: wrap;
408
+ }
409
+
410
+ &_container {
411
+ display: flex;
412
+ flex-wrap: nowrap;
413
+ overflow-x: auto;
414
+ white-space: nowrap;
415
+ transition: all 0.3s ease;
416
+ }
417
+
418
+ &.expanded {
419
+ position: relative;
420
+ z-index: 5;
421
+ }
422
+
423
+ &_hidden {
424
+ width: 100%;
425
+ margin-top: 8px;
426
+ padding-top: 8px;
427
+ border-top: 1px solid rgba(0, 0, 0, 0.05);
428
+ }
429
+
430
+ /**
431
+ * 常见问题项
432
+ * 支持悬停效果和溢出文本处理
433
+ */
434
+ &_item {
435
+ width: 136px;
436
+ text-overflow: ellipsis;
437
+ overflow: hidden;
438
+ display: flex;
439
+ align-items: center;
440
+ gap: 5px;
441
+ white-space: nowrap;
442
+ color: #191919;
443
+ border: none;
444
+ background: #fff;
445
+ margin: 4px 8px 4px 0;
446
+ cursor: pointer;
447
+ text-decoration: none;
448
+ height: 32px;
449
+ padding: 5px 16px;
450
+ border-radius: 26px;
451
+ box-shadow: 0px 4px 16px 0px rgba(0, 0, 0, 0.04);
452
+ transition: all 0.3s ease;
453
+
454
+ & > svg {
455
+ width: 16px;
456
+ height: 16px;
457
+ }
458
+
459
+ /* 悬停效果 */
460
+ &:hover {
461
+ background: rgba(0, 0, 0, 0.08);
462
+ transform: translateY(-1px);
463
+ }
464
+
465
+ &_icon {
466
+ width: 16px;
467
+ height: 16px;
468
+ }
469
+
470
+ &_text {
471
+ width: 84px;
472
+ }
473
+ }
474
+ }
475
+
476
+ /* 向上淡入动画 */
477
+ @keyframes fadeInUp {
478
+ from {
479
+ opacity: 0;
480
+ transform: translateY(10px);
481
+ }
482
+
483
+ to {
484
+ opacity: 1;
485
+ transform: translateY(0);
486
+ }
487
+ }
488
+
489
+ /* 暗色主题下的激活项样式 */
490
+ .theme-dark {
491
+ .tr-suggestion-list-item {
492
+ &.tr-suggestion-item-active {
493
+ background-color: rgba(255, 255, 255, 0.08);
494
+ border-left: 3px solid var(--tr-suggestion-primary-color);
495
+ }
496
+ }
497
+ }
@@ -0,0 +1,12 @@
1
+ import { App } from 'vue'
2
+ import Suggestion from './index.vue'
3
+
4
+ Suggestion.name = 'TrSuggestion'
5
+
6
+ const install = function <T>(app: App<T>) {
7
+ app.component(Suggestion.name!, Suggestion)
8
+ }
9
+
10
+ Suggestion.install = install
11
+
12
+ export default Suggestion as typeof Suggestion & { install: typeof install }
@@ -0,0 +1,101 @@
1
+ import { VNode } from 'vue'
2
+
3
+ /**
4
+ * 分类定义
5
+ */
6
+ export interface Category {
7
+ /** 唯一标识 */
8
+ id: string
9
+ /** 显示名称 */
10
+ label: string
11
+ /** 可选图标 */
12
+ icon?: VNode
13
+ /** 该分类下的指令项 */
14
+ items: SuggestionItem[]
15
+ }
16
+
17
+ /**
18
+ * 指令项定义
19
+ */
20
+ export interface SuggestionItem {
21
+ /** 唯一标识 */
22
+ id: string
23
+ /** 显示文本 */
24
+ text: string
25
+ /** 指令值 */
26
+ value: string
27
+ /** 图标 */
28
+ icon?: VNode
29
+ /** 关键词,用于搜索和过滤 */
30
+ keywords?: string[]
31
+ /** 描述文本 */
32
+ description?: string
33
+ /** 指令模板,用于在输入框中显示可编辑的模板 */
34
+ template?: string
35
+ }
36
+
37
+ /**
38
+ * 触发位置信息
39
+ */
40
+ export interface TriggerContext {
41
+ /** 触发的文本 */
42
+ text: string
43
+ /** 触发的位置 */
44
+ position: number
45
+ }
46
+
47
+ /**
48
+ * 组件属性
49
+ */
50
+ export interface SuggestionProps {
51
+ /** 触发快捷键列表 */
52
+ triggerKeys?: string[]
53
+ /** 指令项列表 */
54
+ items: SuggestionItem[]
55
+ /** 分类列表 */
56
+ categories?: Category[]
57
+ /** 是否显示面板 (支持v-model) */
58
+ open?: boolean
59
+ /** 自定义类名 */
60
+ className?: string
61
+ /** 主题,light或dark */
62
+ theme?: 'light' | 'dark'
63
+ /** 是否显示加载状态 */
64
+ loading?: boolean
65
+ /** 是否点击外部关闭面板 */
66
+ closeOnOutsideClick?: boolean
67
+ /** 面板标题 */
68
+ title?: string
69
+ /** 最大显示条目数 */
70
+ maxVisibleItems?: number
71
+ /** 默认是否展开完整指令列表 */
72
+ defaultExpanded?: boolean
73
+ }
74
+
75
+ /** 触发信息类型 */
76
+ export type TriggerInfo = TriggerContext | false
77
+
78
+ /** 触发处理函数类型 */
79
+ export type TriggerHandler = (info: TriggerInfo) => void
80
+
81
+ /**
82
+ * 组件事件
83
+ */
84
+ export interface SuggestionEmits {
85
+ /** 双向绑定打开状态 (v-model) */
86
+ (e: 'update:open', value: boolean): void
87
+ /** 选中指令项 */
88
+ (e: 'select', value: string, context?: TriggerContext): void
89
+ /** 关闭面板 */
90
+ (e: 'close'): void
91
+ /** 触发回调 */
92
+ (e: 'trigger', handler: TriggerHandler): void
93
+ /** 选择分类 */
94
+ (e: 'category-select', category: Category): void
95
+ /** 点击胶囊指令 */
96
+ (e: 'suggestion-select', item: SuggestionItem): void
97
+ /** 展开/收起状态变化 */
98
+ (e: 'update:expanded', expanded: boolean): void
99
+ /** 填充模板到输入框 */
100
+ (e: 'fill-template', template: string): void
101
+ }