@opentiny/tiny-robot 0.3.0-alpha.15 → 0.3.0-alpha.16

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/index.js CHANGED
@@ -1,213 +1,84 @@
1
- import z from "./attachments/index.js";
2
- import { Bubble as E, BubbleList as x, BubbleProvider as S } from "./bubble/index.js";
3
- import { BubbleContentClassRenderer as pe, BubbleMarkdownContentRenderer as ce } from "./bubble/index.js";
4
- import P from "./container/index.js";
5
- import b from "./conversations/index.js";
6
- import L from "./drag-overlay/index.js";
7
- import C from "./dropdown-menu/index.js";
8
- import B from "./feedback/index.js";
9
- import y from "./history/index.js";
10
- import O from "./icon-button/index.js";
11
- import { Prompt as j, Prompts as H } from "./prompts/index.js";
12
- import w from "./sender/index.js";
13
- import A, { SuggestionPillButton as M } from "./suggestion-pills/index.js";
14
- import R from "./suggestion-popover/index.js";
15
- import k from "./welcome/index.js";
16
- import W from "./mcp-server-picker/index.js";
17
- var d = /* @__PURE__ */ ((e) => (e.FileTypeNotAllowed = "file-type-not-allowed", e.FileSizeExceeded = "file-size-exceeded", e.FileCountExceeded = "file-count-exceeded", e))(d || {});
18
- function $(e, r) {
19
- if (!r) return !0;
20
- const o = r.split(",").map((t) => t.trim());
21
- return o.includes("*") ? !0 : o.some((t) => {
22
- if (t.startsWith("."))
23
- return e.name.toLowerCase().endsWith(t.toLowerCase());
24
- if (t.includes("/*")) {
25
- const a = t.split("/")[0];
26
- return e.type.startsWith(a + "/");
27
- } else
28
- return e.type === t;
29
- });
30
- }
31
- function _(e, r) {
32
- return e.size <= r;
33
- }
34
- function I(e, r) {
35
- return e.length <= r;
36
- }
37
- function N(e, r) {
38
- const { accept: o, multiple: t, maxSize: a, maxFiles: l } = r, n = [], s = [];
39
- if (!I(e, l))
40
- return {
41
- acceptedFiles: n,
42
- rejectedFiles: Array.from(e),
43
- rejectionReason: {
44
- code: d.FileCountExceeded,
45
- message: `文件数量不能超过 ${l} 个`
46
- }
47
- };
48
- if (e.forEach((i) => {
49
- $(i, o) && _(i, a) ? n.push(i) : s.push(i);
50
- }), !t && n.length > 1)
51
- return {
52
- acceptedFiles: [],
53
- rejectedFiles: n,
54
- rejectionReason: {
55
- code: d.FileCountExceeded,
56
- message: "只允许上传一个文件"
57
- }
58
- };
59
- if (s.length > 0) {
60
- const i = s.some((u) => !_(u, a)), p = i ? d.FileSizeExceeded : d.FileTypeNotAllowed, c = i ? `文件大小不能超过 ${a / 1024 / 1024}MB` : `文件类型不匹配 (accept: ${o})`;
61
- return {
62
- acceptedFiles: n,
63
- rejectedFiles: s,
64
- rejectionReason: { code: p, message: c }
65
- };
66
- }
67
- return { acceptedFiles: n, rejectedFiles: s, rejectionReason: null };
68
- }
69
- function g(e) {
70
- return {
71
- accept: e.accept || "*",
72
- multiple: e.multiple ?? !0,
73
- maxSize: e.maxSize || 1024 * 1024 * 10,
74
- maxFiles: e.maxFiles || 3,
75
- onDrop: e.onDrop,
76
- onError: e.onError,
77
- disabled: e.disabled || !1
78
- };
79
- }
80
- const se = {
81
- /**
82
- * 挂载指令
83
- * @param el 元素
84
- * @param binding 绑定
85
- */
86
- mounted(e, r) {
87
- let o = 0;
88
- const { disabled: t, onDraggingChange: a } = r.value;
89
- e.__vDropzoneOptions__ = g(r.value);
90
- const l = {
91
- /**
92
- * 拖拽进入
93
- */
94
- handleDragEnter: () => {
95
- t || (o++, o === 1 && a(!0, e));
96
- },
97
- /**
98
- * 拖拽覆盖
99
- * @param e 事件
100
- */
101
- handleDragOver: (n) => {
102
- t || n.preventDefault();
103
- },
104
- /**
105
- * 拖拽离开
106
- */
107
- handleDragLeave: () => {
108
- t || (o--, o === 0 && a(!1, null));
109
- },
110
- /**
111
- * 拖拽放下
112
- * @param e 事件
113
- */
114
- handleDrop: (n) => {
115
- var m;
116
- if (t) return;
117
- n.preventDefault(), o = 0, a(!1, null);
118
- const s = (m = n.dataTransfer) == null ? void 0 : m.files, { onDrop: i, onError: p, accept: c, multiple: u, maxSize: D, maxFiles: h } = e.__vDropzoneOptions__;
119
- if (s && s.length > 0) {
120
- const F = Array.from(s), { acceptedFiles: v, rejectedFiles: T, rejectionReason: f } = N(F, {
121
- accept: c,
122
- multiple: u,
123
- maxSize: D,
124
- maxFiles: h
125
- });
126
- f && p({ files: T, ...f }), v.length > 0 && i(v);
127
- }
128
- }
129
- };
130
- e.__vDropzoneHandlers__ = l, e.addEventListener("dragenter", l.handleDragEnter), e.addEventListener("dragover", l.handleDragOver), e.addEventListener("dragleave", l.handleDragLeave), e.addEventListener("drop", l.handleDrop);
131
- },
132
- updated(e, r) {
133
- e.__vDropzoneOptions__ && (e.__vDropzoneOptions__ = g(r.value));
134
- },
135
- /**
136
- * 卸载指令
137
- * @param el 元素
138
- */
139
- unmounted(e) {
140
- e.__vDropzoneHandlers__ && (e.removeEventListener("dragenter", e.__vDropzoneHandlers__.handleDragEnter), e.removeEventListener("dragover", e.__vDropzoneHandlers__.handleDragOver), e.removeEventListener("dragleave", e.__vDropzoneHandlers__.handleDragLeave), e.removeEventListener("drop", e.__vDropzoneHandlers__.handleDrop), delete e.__vDropzoneHandlers__), delete e.__vDropzoneOptions__;
141
- }
142
- }, q = [
143
- z,
144
- E,
145
- x,
146
- S,
147
- P,
1
+ import { Bubble as s, BubbleList as t, BubbleProvider as n } from "./bubble/index.js";
2
+ import { BubbleChainMessageRenderer as E, BubbleMarkdownMessageRenderer as j, BubbleMessageClassRenderer as q } from "./bubble/index.js";
3
+ import i from "./container/index.js";
4
+ import a from "./conversations/index.js";
5
+ import m from "./dropdown-menu/index.js";
6
+ import p from "./feedback/index.js";
7
+ import u from "./history/index.js";
8
+ import l from "./icon-button/index.js";
9
+ import { Prompt as T, Prompts as b } from "./prompts/index.js";
10
+ import f from "./question/index.js";
11
+ import g from "./sender/index.js";
12
+ import c from "./welcome/index.js";
13
+ import d from "./suggestion/index.js";
14
+ import B from "./suggestion-popover/index.js";
15
+ import P, { SuggestionPillButton as S } from "./suggestion-pills/index.js";
16
+ const v = [
17
+ s,
18
+ t,
19
+ n,
20
+ i,
21
+ a,
22
+ m,
23
+ p,
24
+ u,
25
+ l,
26
+ T,
148
27
  b,
149
- L,
150
- C,
28
+ f,
29
+ g,
30
+ c,
31
+ d,
151
32
  B,
152
- y,
153
- O,
154
- j,
155
- H,
156
- w,
157
- A,
158
- M,
159
- R,
160
- k,
161
- W
162
- ], ie = {
163
- install(e) {
164
- q.forEach((r) => {
165
- const o = r.name.replace(/^Tiny/, "").replace(/^Tr/, "");
166
- e.component(`Tr${o}`, r);
33
+ P,
34
+ S
35
+ ], L = {
36
+ install(o) {
37
+ v.forEach((r) => {
38
+ const e = r.name.replace(/^Tiny/, "").replace(/^Tr/, "");
39
+ o.component(`Tr${e}`, r);
167
40
  });
168
41
  }
169
42
  };
170
43
  export {
171
- z as Attachments,
172
- E as Bubble,
173
- pe as BubbleContentClassRenderer,
174
- x as BubbleList,
175
- ce as BubbleMarkdownContentRenderer,
176
- S as BubbleProvider,
177
- P as Container,
178
- b as Conversations,
179
- L as DragOverlay,
180
- C as DropdownMenu,
181
- B as Feedback,
182
- y as History,
183
- O as IconButton,
184
- W as McpServerPicker,
185
- j as Prompt,
186
- H as Prompts,
187
- w as Sender,
188
- M as SuggestionPillButton,
189
- A as SuggestionPills,
190
- R as SuggestionPopover,
191
- z as TrAttachments,
192
- E as TrBubble,
193
- x as TrBubbleList,
194
- S as TrBubbleProvider,
195
- P as TrContainer,
196
- b as TrConversations,
197
- L as TrDragOverlay,
198
- C as TrDropdownMenu,
199
- B as TrFeedback,
200
- y as TrHistory,
201
- O as TrIconButton,
202
- W as TrMcpServerPicker,
203
- j as TrPrompt,
204
- H as TrPrompts,
205
- w as TrSender,
206
- M as TrSuggestionPillButton,
207
- A as TrSuggestionPills,
208
- R as TrSuggestionPopover,
209
- k as TrWelcome,
210
- k as Welcome,
211
- ie as default,
212
- se as vDropzone
44
+ s as Bubble,
45
+ E as BubbleChainMessageRenderer,
46
+ t as BubbleList,
47
+ j as BubbleMarkdownMessageRenderer,
48
+ q as BubbleMessageClassRenderer,
49
+ n as BubbleProvider,
50
+ i as Container,
51
+ a as Conversations,
52
+ m as DropdownMenu,
53
+ p as Feedback,
54
+ u as History,
55
+ l as IconButton,
56
+ T as Prompt,
57
+ b as Prompts,
58
+ f as Question,
59
+ g as Sender,
60
+ d as Suggestion,
61
+ S as SuggestionPillButton,
62
+ P as SuggestionPills,
63
+ B as SuggestionPopover,
64
+ s as TrBubble,
65
+ t as TrBubbleList,
66
+ n as TrBubbleProvider,
67
+ i as TrContainer,
68
+ a as TrConversations,
69
+ m as TrDropdownMenu,
70
+ p as TrFeedback,
71
+ u as TrHistory,
72
+ l as TrIconButton,
73
+ T as TrPrompt,
74
+ b as TrPrompts,
75
+ f as TrQuestion,
76
+ g as TrSender,
77
+ d as TrSuggestion,
78
+ S as TrSuggestionPillButton,
79
+ P as TrSuggestionPills,
80
+ B as TrSuggestionPopover,
81
+ c as TrWelcome,
82
+ c as Welcome,
83
+ L as default
213
84
  };