@opentiny/tiny-robot 0.1.0 → 0.2.0-alpha.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/dist/bubble/index.type.d.ts +1 -1
- package/dist/container/index.d.ts +7 -0
- package/dist/container/index.type.d.ts +16 -0
- package/dist/container/index.vue.d.ts +26 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +26 -22
- package/dist/packages/components/src/bubble/bubble-list.vue.js +2 -2
- package/dist/packages/components/src/bubble/bubble-list.vue2.js +18 -19
- package/dist/packages/components/src/container/index.js +9 -0
- package/dist/packages/components/src/container/index.vue.js +7 -0
- package/dist/packages/components/src/container/index.vue2.js +55 -0
- package/dist/packages/components/src/question/components/HotQuestions.vue.js +13 -13
- package/dist/packages/components/src/question/index.vue.js +14 -14
- package/dist/packages/svgs/dist/tiny-robot-svgs.js +133 -54
- package/dist/question/index.vue.d.ts +1 -1
- package/dist/sender/components/ActionButtons.vue.d.ts +2 -2
- package/dist/sender/index.vue.d.ts +2 -2
- package/dist/style.css +1 -1
- package/package.json +4 -5
- package/src/bubble/bubble-list.vue +1 -3
- package/src/bubble/index.type.ts +1 -1
- package/src/container/index.ts +12 -0
- package/src/container/index.type.ts +17 -0
- package/src/container/index.vue +135 -0
- package/src/index.ts +5 -2
- package/.vscode/extensions.json +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/tiny-robot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-alpha.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -16,14 +16,13 @@
|
|
|
16
16
|
"vue": "^3.3.11"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@opentiny/tiny-robot-svgs": "0.
|
|
19
|
+
"@opentiny/tiny-robot-svgs": "0.2.0-alpha.0",
|
|
20
20
|
"@opentiny/vue": "^3.21.0",
|
|
21
21
|
"@opentiny/vue-button": "^3.21.0",
|
|
22
22
|
"@opentiny/vue-icon": "^3.22.0",
|
|
23
23
|
"@opentiny/vue-input": "^3.21.0",
|
|
24
24
|
"@opentiny/vue-tooltip": "^3.22.0",
|
|
25
|
-
"markdown-it": "^14.1.0"
|
|
26
|
-
"vue": "^3.3.11"
|
|
25
|
+
"markdown-it": "^14.1.0"
|
|
27
26
|
},
|
|
28
27
|
"devDependencies": {
|
|
29
28
|
"@opentiny/vue-vite-import": "^1.3.0",
|
|
@@ -40,5 +39,5 @@
|
|
|
40
39
|
"vue": "^3.3.11",
|
|
41
40
|
"vue-tsc": "^2.2.8"
|
|
42
41
|
},
|
|
43
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "3517724651afbbb05b1be20487a9f3341c06133c"
|
|
44
43
|
}
|
|
@@ -21,9 +21,7 @@ watch([() => props.items.length, () => lastBubble.value?.content], () => {
|
|
|
21
21
|
|
|
22
22
|
const getItemProps = (item: BubbleProps): BubbleProps => {
|
|
23
23
|
const defaultConfig = item.role ? props.roles?.[item.role] || {} : {}
|
|
24
|
-
|
|
25
|
-
const { id, ...rest } = item
|
|
26
|
-
return { ...defaultConfig, ...rest }
|
|
24
|
+
return { ...defaultConfig, ...item }
|
|
27
25
|
}
|
|
28
26
|
</script>
|
|
29
27
|
|
package/src/bubble/index.type.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { App } from 'vue'
|
|
2
|
+
import Container from './index.vue'
|
|
3
|
+
|
|
4
|
+
Container.name = 'TrContainer'
|
|
5
|
+
|
|
6
|
+
const install = function <T>(app: App<T>) {
|
|
7
|
+
app.component(Container.name!, Container)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
Container.install = install
|
|
11
|
+
|
|
12
|
+
export default Container as typeof Container & { install: typeof install }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ContainerProps {
|
|
2
|
+
/**
|
|
3
|
+
* model:show
|
|
4
|
+
*/
|
|
5
|
+
show: boolean
|
|
6
|
+
/**
|
|
7
|
+
* model:fullscreen
|
|
8
|
+
*/
|
|
9
|
+
fullscreen?: boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ContainerSlots {
|
|
13
|
+
default: () => unknown
|
|
14
|
+
title: () => unknown
|
|
15
|
+
operations: () => unknown
|
|
16
|
+
footer: () => unknown
|
|
17
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { IconCancelFullScreen, IconClose, IconFullScreen } from '@opentiny/tiny-robot-svgs'
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
import { ContainerProps, ContainerSlots } from './index.type'
|
|
5
|
+
|
|
6
|
+
const show = defineModel<ContainerProps['show']>('show', { required: true })
|
|
7
|
+
const fullscreen = defineModel<ContainerProps['fullscreen']>('fullscreen')
|
|
8
|
+
|
|
9
|
+
defineSlots<ContainerSlots>()
|
|
10
|
+
|
|
11
|
+
const IconFullScreenSwitcher = computed(() => (fullscreen.value ? IconCancelFullScreen : IconFullScreen))
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div class="tr-container">
|
|
16
|
+
<div class="tr-container__dragging-bar-wrapper">
|
|
17
|
+
<div class="tr-container__dragging-bar"></div>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="tr-container__header">
|
|
20
|
+
<slot name="title">
|
|
21
|
+
<h3 class="tr-container__title">OpenTiny NEXT</h3>
|
|
22
|
+
</slot>
|
|
23
|
+
<div class="tr-container__header-operations">
|
|
24
|
+
<slot name="operations"></slot>
|
|
25
|
+
<button class="icon-btn" @click="$emit('update:fullscreen', !fullscreen)">
|
|
26
|
+
<IconFullScreenSwitcher />
|
|
27
|
+
</button>
|
|
28
|
+
<button class="icon-btn" @click="$emit('update:show', false)">
|
|
29
|
+
<IconClose />
|
|
30
|
+
</button>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="tr-container__body">
|
|
34
|
+
<slot></slot>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="tr-container__footer">
|
|
37
|
+
<slot name="footer"></slot>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<style lang="less" scoped>
|
|
43
|
+
.tr-container {
|
|
44
|
+
--tr-container-width: 480px;
|
|
45
|
+
|
|
46
|
+
background-color: rgb(248, 248, 248);
|
|
47
|
+
border: 1px solid rgba(0, 0, 0, 0.08);
|
|
48
|
+
position: fixed;
|
|
49
|
+
top: 0;
|
|
50
|
+
bottom: 0;
|
|
51
|
+
right: 0;
|
|
52
|
+
left: v-bind('fullscreen? "0" : "unset"');
|
|
53
|
+
width: v-bind('fullscreen? "unset" : "var(--tr-container-width)"');
|
|
54
|
+
z-index: v-bind('show? "100":"-1"');
|
|
55
|
+
opacity: v-bind('show? "1":"0"');
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
|
|
59
|
+
.tr-container__dragging-bar-wrapper {
|
|
60
|
+
flex-shrink: 0;
|
|
61
|
+
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
padding: 6px;
|
|
66
|
+
|
|
67
|
+
// TODO 拖拽条的逻辑
|
|
68
|
+
.tr-container__dragging-bar {
|
|
69
|
+
width: 40px;
|
|
70
|
+
height: 4px;
|
|
71
|
+
background-color: rgb(217, 217, 217);
|
|
72
|
+
border-radius: 999px;
|
|
73
|
+
cursor: grab;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.tr-container__header {
|
|
78
|
+
flex-shrink: 0;
|
|
79
|
+
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
justify-content: space-between;
|
|
83
|
+
padding: 4px 24px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.tr-container__title {
|
|
87
|
+
margin: 0;
|
|
88
|
+
padding: 0;
|
|
89
|
+
color: rgb(25, 25, 25);
|
|
90
|
+
font-weight: 600;
|
|
91
|
+
font-size: 14px;
|
|
92
|
+
line-height: 22px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.tr-container__header-operations {
|
|
96
|
+
display: flex;
|
|
97
|
+
gap: 8px;
|
|
98
|
+
|
|
99
|
+
button.icon-btn {
|
|
100
|
+
width: 28px;
|
|
101
|
+
height: 28px;
|
|
102
|
+
display: inline-flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
justify-content: center;
|
|
105
|
+
border: none;
|
|
106
|
+
border-radius: 8px;
|
|
107
|
+
cursor: pointer;
|
|
108
|
+
padding: 0;
|
|
109
|
+
transition: background-color 0.3s;
|
|
110
|
+
|
|
111
|
+
&:hover {
|
|
112
|
+
background-color: rgba(0, 0, 0, 0.04);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&:active {
|
|
116
|
+
background-color: rgba(0, 0, 0, 0.15);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
svg {
|
|
120
|
+
width: 20px;
|
|
121
|
+
height: 20px;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.tr-container__body {
|
|
127
|
+
flex: 1;
|
|
128
|
+
overflow-y: auto;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.tr-container__footer {
|
|
132
|
+
flex-shrink: 0;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
</style>
|
package/src/index.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { App } from 'vue'
|
|
2
2
|
import { Bubble, BubbleList } from './bubble'
|
|
3
|
+
import Container from './container'
|
|
3
4
|
import Conversations from './conversations'
|
|
4
5
|
import { Prompt, Prompts } from './prompts'
|
|
6
|
+
import Question from './question'
|
|
5
7
|
import Sender from './sender'
|
|
6
8
|
import Welcome from './welcome'
|
|
7
|
-
import Question from './question'
|
|
8
9
|
|
|
9
10
|
export * from './bubble/index.type'
|
|
10
11
|
export * from './prompts/index.type'
|
|
11
12
|
export * from './sender/index.type'
|
|
12
13
|
export * from './welcome/index.type'
|
|
13
14
|
|
|
14
|
-
const components = [Bubble, BubbleList, Conversations, Prompt, Prompts, Sender, Welcome
|
|
15
|
+
const components = [Bubble, BubbleList, Container, Conversations, Prompt, Prompts, Question, Sender, Welcome]
|
|
15
16
|
|
|
16
17
|
export default {
|
|
17
18
|
install<T>(app: App<T>) {
|
|
@@ -27,6 +28,8 @@ export {
|
|
|
27
28
|
Bubble as TrBubble,
|
|
28
29
|
BubbleList,
|
|
29
30
|
BubbleList as TrBubbleList,
|
|
31
|
+
Container,
|
|
32
|
+
Container as TrContainer,
|
|
30
33
|
Conversations,
|
|
31
34
|
Conversations as TrConversations,
|
|
32
35
|
Prompt,
|
package/.vscode/extensions.json
DELETED