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