@opentiny/tiny-robot 0.3.0-alpha.3 → 0.3.0-alpha.31

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