@opentiny/tiny-robot 0.3.0-rc.0 → 0.3.0-rc.2

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,6 +1,6 @@
1
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";
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
4
  import P from "./container/index.js";
5
5
  import b from "./conversations/index.js";
6
6
  import L from "./drag-overlay/index.js";
@@ -12,31 +12,33 @@ import { Prompt as j, Prompts as H } from "./prompts/index.js";
12
12
  import w from "./sender/index.js";
13
13
  import A, { SuggestionPillButton as M } from "./suggestion-pills/index.js";
14
14
  import R from "./suggestion-popover/index.js";
15
- import k from "./welcome/index.js";
16
- import W from "./mcp-server-picker/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";
17
19
  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) {
20
+ function I(e, r) {
19
21
  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];
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];
26
28
  return e.type.startsWith(a + "/");
27
29
  } else
28
- return e.type === t;
30
+ return e.type === o;
29
31
  });
30
32
  }
31
33
  function _(e, r) {
32
34
  return e.size <= r;
33
35
  }
34
- function I(e, r) {
36
+ function N(e, r) {
35
37
  return e.length <= r;
36
38
  }
37
- function N(e, r) {
38
- const { accept: o, multiple: t, maxSize: a, maxFiles: l } = r, n = [], s = [];
39
- if (!I(e, l))
39
+ function q(e, r) {
40
+ const { accept: t, multiple: o, maxSize: a, maxFiles: l } = r, n = [], s = [];
41
+ if (!N(e, l))
40
42
  return {
41
43
  acceptedFiles: n,
42
44
  rejectedFiles: Array.from(e),
@@ -46,8 +48,8 @@ function N(e, r) {
46
48
  }
47
49
  };
48
50
  if (e.forEach((i) => {
49
- $(i, o) && _(i, a) ? n.push(i) : s.push(i);
50
- }), !t && n.length > 1)
51
+ I(i, t) && _(i, a) ? n.push(i) : s.push(i);
52
+ }), !o && n.length > 1)
51
53
  return {
52
54
  acceptedFiles: [],
53
55
  rejectedFiles: n,
@@ -57,11 +59,11 @@ function N(e, r) {
57
59
  }
58
60
  };
59
61
  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})`;
62
+ const i = s.some((c) => !_(c, a)), p = i ? d.FileSizeExceeded : d.FileTypeNotAllowed, m = i ? `文件大小不能超过 ${a / 1024 / 1024}MB` : `文件类型不匹配 (accept: ${t})`;
61
63
  return {
62
64
  acceptedFiles: n,
63
65
  rejectedFiles: s,
64
- rejectionReason: { code: p, message: c }
66
+ rejectionReason: { code: p, message: m }
65
67
  };
66
68
  }
67
69
  return { acceptedFiles: n, rejectedFiles: s, rejectionReason: null };
@@ -77,53 +79,53 @@ function g(e) {
77
79
  disabled: e.disabled || !1
78
80
  };
79
81
  }
80
- const se = {
82
+ const le = {
81
83
  /**
82
84
  * 挂载指令
83
85
  * @param el 元素
84
86
  * @param binding 绑定
85
87
  */
86
88
  mounted(e, r) {
87
- let o = 0;
88
- const { disabled: t, onDraggingChange: a } = r.value;
89
+ let t = 0;
90
+ const { disabled: o, onDraggingChange: a } = r.value;
89
91
  e.__vDropzoneOptions__ = g(r.value);
90
92
  const l = {
91
93
  /**
92
94
  * 拖拽进入
93
95
  */
94
96
  handleDragEnter: () => {
95
- t || (o++, o === 1 && a(!0, e));
97
+ o || (t++, t === 1 && a(!0, e));
96
98
  },
97
99
  /**
98
100
  * 拖拽覆盖
99
101
  * @param e 事件
100
102
  */
101
103
  handleDragOver: (n) => {
102
- t || n.preventDefault();
104
+ o || n.preventDefault();
103
105
  },
104
106
  /**
105
107
  * 拖拽离开
106
108
  */
107
109
  handleDragLeave: () => {
108
- t || (o--, o === 0 && a(!1, null));
110
+ o || (t--, t === 0 && a(!1, null));
109
111
  },
110
112
  /**
111
113
  * 拖拽放下
112
114
  * @param e 事件
113
115
  */
114
116
  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__;
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__;
119
121
  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,
122
+ const T = Array.from(s), { acceptedFiles: v, rejectedFiles: F, rejectionReason: f } = q(T, {
123
+ accept: m,
124
+ multiple: c,
123
125
  maxSize: D,
124
126
  maxFiles: h
125
127
  });
126
- f && p({ files: T, ...f }), v.length > 0 && i(v);
128
+ f && p({ files: F, ...f }), v.length > 0 && i(v);
127
129
  }
128
130
  }
129
131
  };
@@ -139,10 +141,10 @@ const se = {
139
141
  unmounted(e) {
140
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__;
141
143
  }
142
- }, q = [
144
+ }, G = [
143
145
  z,
144
- E,
145
146
  x,
147
+ E,
146
148
  S,
147
149
  P,
148
150
  b,
@@ -158,21 +160,22 @@ const se = {
158
160
  M,
159
161
  R,
160
162
  k,
161
- W
162
- ], ie = {
163
+ W,
164
+ $
165
+ ], de = {
163
166
  install(e) {
164
- q.forEach((r) => {
165
- const o = r.name.replace(/^Tiny/, "").replace(/^Tr/, "");
166
- e.component(`Tr${o}`, r);
167
+ G.forEach((r) => {
168
+ const t = r.name.replace(/^Tiny/, "").replace(/^Tr/, "");
169
+ e.component(`Tr${t}`, r);
167
170
  });
168
171
  }
169
172
  };
170
173
  export {
171
174
  z as Attachments,
172
- E as Bubble,
173
- pe as BubbleContentClassRenderer,
174
- x as BubbleList,
175
- ce as BubbleMarkdownContentRenderer,
175
+ x as Bubble,
176
+ ce as BubbleContentClassRenderer,
177
+ E as BubbleList,
178
+ ue as BubbleMarkdownContentRenderer,
176
179
  S as BubbleProvider,
177
180
  P as Container,
178
181
  b as Conversations,
@@ -181,16 +184,17 @@ export {
181
184
  B as Feedback,
182
185
  y as History,
183
186
  O as IconButton,
184
- W as McpServerPicker,
187
+ $ as McpServerPicker,
185
188
  j as Prompt,
186
189
  H as Prompts,
187
190
  w as Sender,
188
191
  M as SuggestionPillButton,
189
192
  A as SuggestionPills,
190
193
  R as SuggestionPopover,
194
+ k as ThemeProvider,
191
195
  z as TrAttachments,
192
- E as TrBubble,
193
- x as TrBubbleList,
196
+ x as TrBubble,
197
+ E as TrBubbleList,
194
198
  S as TrBubbleProvider,
195
199
  P as TrContainer,
196
200
  b as TrConversations,
@@ -199,15 +203,17 @@ export {
199
203
  B as TrFeedback,
200
204
  y as TrHistory,
201
205
  O as TrIconButton,
202
- W as TrMcpServerPicker,
206
+ $ as TrMcpServerPicker,
203
207
  j as TrPrompt,
204
208
  H as TrPrompts,
205
209
  w as TrSender,
206
210
  M as TrSuggestionPillButton,
207
211
  A as TrSuggestionPills,
208
212
  R as TrSuggestionPopover,
209
- k as TrWelcome,
210
- k as Welcome,
211
- ie as default,
212
- se as vDropzone
213
+ k as TrThemeProvider,
214
+ W as TrWelcome,
215
+ W as Welcome,
216
+ de as default,
217
+ fe as useTheme,
218
+ le as vDropzone
213
219
  };
package/dist/index2.js CHANGED
@@ -1,6 +1,6 @@
1
- import { onMounted as re, nextTick as me, watch as k, getCurrentScope as ge, onScopeDispose as we, getCurrentInstance as j, isRef as ie, toValue as w, hasInjectionContext as le, inject as be, toRefs as ye, customRef as Oe, shallowRef as y, computed as P, reactive as Z, unref as Se, watchEffect as se, ref as ue, readonly as Te } from "vue";
1
+ import { onMounted as re, nextTick as he, watch as k, getCurrentScope as me, onScopeDispose as ge, getCurrentInstance as j, isRef as ie, toValue as w, hasInjectionContext as le, inject as we, toRefs as be, customRef as ye, shallowRef as y, computed as P, reactive as Z, unref as Oe, watchEffect as se, ref as Se, readonly as Te } from "vue";
2
2
  function z(e) {
3
- return ge() ? (we(e), !0) : !1;
3
+ return me() ? (ge(e), !0) : !1;
4
4
  }
5
5
  // @__NO_SIDE_EFFECTS__
6
6
  function ee() {
@@ -27,7 +27,7 @@ const B = /* @__PURE__ */ new WeakMap(), Ee = /* @__NO_SIDE_EFFECTS__ */ (...e)
27
27
  const o = e[0], n = (t = j()) == null ? void 0 : t.proxy;
28
28
  if (n == null && !le())
29
29
  throw new Error("injectLocal must be called in setup");
30
- return n && B.has(n) && o in B.get(n) ? B.get(n)[o] : be(...e);
30
+ return n && B.has(n) && o in B.get(n) ? B.get(n)[o] : we(...e);
31
31
  }, $ = typeof window < "u" && typeof document < "u";
32
32
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
33
33
  const xe = (e) => e != null, We = Object.prototype.toString, Me = (e) => We.call(e) === "[object Object]", W = () => {
@@ -45,7 +45,7 @@ function Y(e, t) {
45
45
  return o;
46
46
  }
47
47
  const Fe = (e) => e();
48
- function ce(e, t = {}) {
48
+ function ue(e, t = {}) {
49
49
  let o, n, u = W;
50
50
  const i = (s) => {
51
51
  clearTimeout(s), u(), u = W;
@@ -62,7 +62,7 @@ function ce(e, t = {}) {
62
62
  });
63
63
  };
64
64
  }
65
- function ae(...e) {
65
+ function ce(...e) {
66
66
  let t = 0, o, n = !0, u = W, i, a, r, s, d;
67
67
  !ie(e[0]) && typeof e[0] == "object" ? { delay: a, trailing: r = !0, leading: s = !0, rejectOnCancel: d = !1 } = e[0] : [a, r = !0, s = !0, d = !1] = e;
68
68
  const v = () => {
@@ -92,18 +92,18 @@ function Le(e) {
92
92
  // @__NO_SIDE_EFFECTS__
93
93
  function ke(e, t = 200, o = {}) {
94
94
  return Y(
95
- ce(t, o),
95
+ ue(t, o),
96
96
  e
97
97
  );
98
98
  }
99
99
  // @__NO_SIDE_EFFECTS__
100
100
  function De(e, t = 200, o = !1, n = !0, u = !1) {
101
101
  return Y(
102
- ae(t, o, n, u),
102
+ ce(t, o, n, u),
103
103
  e
104
104
  );
105
105
  }
106
- function fe(e, t, o = {}) {
106
+ function ae(e, t, o = {}) {
107
107
  const {
108
108
  eventFilter: n = Fe,
109
109
  ...u
@@ -119,10 +119,10 @@ function fe(e, t, o = {}) {
119
119
  }
120
120
  function Re(e, t = {}) {
121
121
  if (!ie(e))
122
- return ye(e);
122
+ return be(e);
123
123
  const o = Array.isArray(e.value) ? Array.from({ length: e.value.length }) : {};
124
124
  for (const n in e.value)
125
- o[n] = Oe(() => ({
125
+ o[n] = ye(() => ({
126
126
  get() {
127
127
  return e.value[n];
128
128
  },
@@ -143,7 +143,7 @@ function Re(e, t = {}) {
143
143
  return o;
144
144
  }
145
145
  function N(e, t = !0, o) {
146
- Le() ? re(e, o) : t ? e() : me(e);
146
+ Le() ? re(e, o) : t ? e() : he(e);
147
147
  }
148
148
  function Xe(e, t, o = {}) {
149
149
  const {
@@ -151,12 +151,12 @@ function Xe(e, t, o = {}) {
151
151
  maxWait: u = void 0,
152
152
  ...i
153
153
  } = o;
154
- return fe(
154
+ return ae(
155
155
  e,
156
156
  t,
157
157
  {
158
158
  ...i,
159
- eventFilter: ce(n, { maxWait: u })
159
+ eventFilter: ue(n, { maxWait: u })
160
160
  }
161
161
  );
162
162
  }
@@ -177,12 +177,12 @@ function Qe(e, t, o = {}) {
177
177
  leading: i = !0,
178
178
  ...a
179
179
  } = o;
180
- return fe(
180
+ return ae(
181
181
  e,
182
182
  t,
183
183
  {
184
184
  ...a,
185
- eventFilter: ae(n, u, i)
185
+ eventFilter: ce(n, u, i)
186
186
  }
187
187
  );
188
188
  }
@@ -204,7 +204,7 @@ function M(...e) {
204
204
  return [
205
205
  (s = (r = u.value) == null ? void 0 : r.map((d) => S(d))) != null ? s : [A].filter((d) => d != null),
206
206
  C(w(u.value ? e[1] : e[0])),
207
- C(Se(u.value ? e[2] : e[1])),
207
+ C(Oe(u.value ? e[2] : e[1])),
208
208
  // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
209
209
  w(u.value ? e[3] : e[2])
210
210
  ];
@@ -305,7 +305,7 @@ function G(e) {
305
305
  const t = /* @__PURE__ */ He();
306
306
  return P(() => (t.value, !!e()));
307
307
  }
308
- function de(e, t, o = {}) {
308
+ function fe(e, t, o = {}) {
309
309
  const { window: n = A, ...u } = o;
310
310
  let i;
311
311
  const a = /* @__PURE__ */ G(() => n && "MutationObserver" in n), r = () => {
@@ -314,7 +314,7 @@ function de(e, t, o = {}) {
314
314
  const c = w(e), p = C(c).map(S).filter(xe);
315
315
  return new Set(p);
316
316
  }), d = k(
317
- () => s.value,
317
+ s,
318
318
  (c) => {
319
319
  r(), a.value && c.size && (i = new MutationObserver(t), c.forEach((p) => i.observe(p, u)));
320
320
  },
@@ -352,7 +352,7 @@ function Be(e, t = {}) {
352
352
  u.value && (a.value = o.matchMedia(w(e)), r.value = a.value.matches);
353
353
  }), M(a, "change", s, { passive: !0 }), P(() => r.value);
354
354
  }
355
- function ve(e, t, o = {}) {
355
+ function de(e, t, o = {}) {
356
356
  const { window: n = A, ...u } = o;
357
357
  let i;
358
358
  const a = /* @__PURE__ */ G(() => n && "ResizeObserver" in n), r = () => {
@@ -398,7 +398,7 @@ function qe(e, t = {}) {
398
398
  function f() {
399
399
  a === "sync" ? O() : a === "next-frame" && requestAnimationFrame(() => O());
400
400
  }
401
- return ve(e, f), k(() => S(e), (m) => !m && f()), de(e, f, {
401
+ return de(e, f), k(() => S(e), (m) => !m && f()), fe(e, f, {
402
402
  attributeFilter: ["style", "class"]
403
403
  }), u && M("scroll", f, { capture: !0, passive: !0 }), n && M("resize", f, { passive: !0 }), N(() => {
404
404
  i && f();
@@ -418,7 +418,7 @@ function Je(e, t = { width: 0, height: 0 }, o = {}) {
418
418
  const { window: n = A, box: u = "content-box" } = o, i = P(() => {
419
419
  var l, c;
420
420
  return (c = (l = S(e)) == null ? void 0 : l.namespaceURI) == null ? void 0 : c.includes("svg");
421
- }), a = y(t.width), r = y(t.height), { stop: s } = ve(
421
+ }), a = y(t.width), r = y(t.height), { stop: s } = de(
422
422
  e,
423
423
  ([l]) => {
424
424
  const c = u === "border-box" ? l.borderBoxSize : u === "content-box" ? l.contentBoxSize : l.devicePixelContentBoxSize;
@@ -474,7 +474,7 @@ function $e(e) {
474
474
  function Ke(e = {}) {
475
475
  const {
476
476
  document: t = Ve
477
- } = e, o = ue($e(e.initialFiles)), { on: n, trigger: u } = /* @__PURE__ */ ee(), { on: i, trigger: a } = /* @__PURE__ */ ee(), r = P(() => {
477
+ } = e, o = Se($e(e.initialFiles)), { on: n, trigger: u } = /* @__PURE__ */ ee(), { on: i, trigger: a } = /* @__PURE__ */ ee(), r = P(() => {
478
478
  var l;
479
479
  const c = (l = S(e.input)) != null ? l : t ? t.createElement("input") : void 0;
480
480
  return c && (c.type = "file", c.onchange = (p) => {
@@ -578,7 +578,7 @@ function Ze(e, t = {}) {
578
578
  bottom: !1
579
579
  }), X = (g) => {
580
580
  b.value && (b.value = !1, E.left = !1, E.right = !1, E.top = !1, E.bottom = !1, u(g));
581
- }, he = /* @__PURE__ */ ke(X, o + n), V = (g) => {
581
+ }, pe = /* @__PURE__ */ ke(X, o + n), V = (g) => {
582
582
  var _;
583
583
  if (!v)
584
584
  return;
@@ -595,7 +595,7 @@ function Ze(e, t = {}) {
595
595
  if (!v)
596
596
  return;
597
597
  const x = (_ = g.target.documentElement) != null ? _ : g.target;
598
- V(x), b.value = !0, he(g), i(g);
598
+ V(x), b.value = !0, pe(g), i(g);
599
599
  };
600
600
  return M(
601
601
  e,
@@ -611,7 +611,7 @@ function Ze(e, t = {}) {
611
611
  } catch (g) {
612
612
  l(g);
613
613
  }
614
- }), c != null && c.mutation && e != null && e !== v && e !== document && de(
614
+ }), c != null && c.mutation && e != null && e !== v && e !== document && fe(
615
615
  e,
616
616
  () => {
617
617
  const g = w(e);
@@ -639,7 +639,7 @@ function Ze(e, t = {}) {
639
639
  }
640
640
  };
641
641
  }
642
- const pe = {
642
+ const ve = {
643
643
  x: 0,
644
644
  y: 0,
645
645
  pointerId: 0,
@@ -650,12 +650,12 @@ const pe = {
650
650
  height: 0,
651
651
  twist: 0,
652
652
  pointerType: null
653
- }, Ye = /* @__PURE__ */ Object.keys(pe);
653
+ }, Ye = /* @__PURE__ */ Object.keys(ve);
654
654
  function et(e = {}) {
655
655
  const {
656
656
  target: t = A
657
- } = e, o = y(!1), n = ue(e.initialValue || {});
658
- Object.assign(n.value, pe, n.value);
657
+ } = e, o = y(!1), n = y(e.initialValue || {});
658
+ Object.assign(n.value, ve, n.value);
659
659
  const u = (i) => {
660
660
  o.value = !0, !(e.pointerTypes && !e.pointerTypes.includes(i.pointerType)) && (n.value = _e(i, Ye, !1));
661
661
  };