@opentiny/tiny-robot 0.3.1-alpha.6 → 0.3.1-alpha.7

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.
@@ -1,13 +0,0 @@
1
- import { A as a, _ as e, D as n, S as s, W as u } from "../index2.js";
2
- import { _ as B, V as c, W as l, u as p } from "../index3.js";
3
- export {
4
- a as ActionButton,
5
- e as ClearButton,
6
- n as DefaultActionButtons,
7
- s as SubmitButton,
8
- B as UploadButton,
9
- c as VoiceButton,
10
- l as WebSpeechHandler,
11
- u as WordCounter,
12
- p as useSpeechHandler
13
- };
package/dist/index6.js DELETED
@@ -1,161 +0,0 @@
1
- import { onMounted as U, nextTick as B, h as C, defineComponent as _, render as R, onBeforeUnmount as D, Teleport as W, computed as h, ref as E, createBlock as F, openBlock as g, Transition as j, normalizeProps as q, guardReactiveProps as L, withCtx as Z, createElementBlock as G, createCommentVNode as J, renderSlot as K, useSlots as Q, watch as X, useAttrs as Y, resolveDynamicComponent as ee, unref as S, mergeProps as k, createVNode as te } from "vue";
2
- import { a as oe, d as re, c as ne } from "./index4.js";
3
- import { t as u } from "./utils.js";
4
- import { _ as N } from "./_plugin-vue_export-helper.js";
5
- import { u as se } from "./useSlotRefs.js";
6
- const pe = _({
7
- setup: (r) => () => C(W, r.propsFactory(), r.vnodeFactory()),
8
- props: ["propsFactory", "vnodeFactory"]
9
- });
10
- function ae(r, n) {
11
- let e = null, t = null, s = !1;
12
- U(() => {
13
- B(() => {
14
- s || (t = document.createElement("div"), e = C(pe, { propsFactory: r, vnodeFactory: n }), R(e, t));
15
- });
16
- }), D(() => {
17
- s = !0, B(() => {
18
- t && (R(null, t), t.remove(), e = null, t = null);
19
- });
20
- });
21
- }
22
- function ce(r, n) {
23
- return h(() => {
24
- var v;
25
- if (n instanceof HTMLElement)
26
- return n;
27
- const e = n, t = oe(r), s = (v = t == null ? void 0 : t.getRootNode) == null ? void 0 : v.call(t), i = s instanceof ShadowRoot, d = i ? s : document.body;
28
- if (e) {
29
- if (!i && e === "body")
30
- return document.body;
31
- const f = d.querySelector(e);
32
- if (f instanceof Node) return f;
33
- }
34
- return d;
35
- });
36
- }
37
- const ie = /* @__PURE__ */ _({
38
- __name: "Popper",
39
- props: {
40
- show: { type: Boolean },
41
- transitionProps: {}
42
- },
43
- setup(r, { expose: n }) {
44
- const e = E(null);
45
- return n({
46
- popperRef: e
47
- }), (t, s) => (g(), F(j, q(L(r.transitionProps)), {
48
- default: Z(() => [
49
- r.show ? (g(), G("div", {
50
- key: 0,
51
- class: "tr-base-popper",
52
- ref_key: "popperRef",
53
- ref: e
54
- }, [
55
- K(t.$slots, "default", {}, void 0, !0)
56
- ], 512)) : J("", !0)
57
- ]),
58
- _: 3
59
- }, 16));
60
- }
61
- }), le = /* @__PURE__ */ N(ie, [["__scopeId", "data-v-25c13ab7"]]), ue = /* @__PURE__ */ _({
62
- inheritAttrs: !1,
63
- __name: "index",
64
- props: {
65
- appendTo: {},
66
- offset: {},
67
- placement: {
68
- default: "top-center"
69
- },
70
- preventOverflow: {
71
- type: Boolean
72
- },
73
- show: {
74
- type: Boolean
75
- },
76
- transitionProps: {},
77
- triggerEvents: {}
78
- },
79
- setup(r, {
80
- expose: n
81
- }) {
82
- const e = r, t = Q(), {
83
- vnodes: s,
84
- ref: i,
85
- setRef: d
86
- } = se(t.trigger), v = (o = {}) => {
87
- const p = {};
88
- for (const [c, a] of Object.entries(o))
89
- /^on[A-Z]/.test(c) && typeof a == "function" && (p[c] = a);
90
- return p;
91
- }, f = E(null), b = h(() => {
92
- var o;
93
- return ((o = f.value) == null ? void 0 : o.popperRef) || null;
94
- }), m = h(() => {
95
- var o, p;
96
- return typeof e.offset == "number" ? {
97
- mainAxis: e.offset,
98
- crossAxis: 0
99
- } : {
100
- mainAxis: ((o = e.offset) == null ? void 0 : o.mainAxis) ?? 0,
101
- crossAxis: ((p = e.offset) == null ? void 0 : p.crossAxis) ?? 0
102
- };
103
- }), {
104
- top: $,
105
- bottom: O,
106
- left: w,
107
- right: V,
108
- width: z,
109
- update: A
110
- } = re(i), {
111
- width: x,
112
- height: P
113
- } = ne(b, void 0, {
114
- box: "border-box"
115
- }), H = h(() => {
116
- const {
117
- placement: o,
118
- preventOverflow: p
119
- } = e, c = {}, a = (l, y) => {
120
- if (!p) {
121
- c[l] = y;
122
- return;
123
- }
124
- const T = u(l === "top" ? P.value : x.value);
125
- l === "top" ? c[l] = `clamp(var(--tr-base-popper-min-top), ${y}, calc(var(--tr-base-popper-max-bottom) - ${T}))` : l === "left" && (c[l] = `clamp(var(--tr-base-popper-min-left), ${y}, calc(var(--tr-base-popper-max-right) - ${T}))`);
126
- };
127
- return o.includes("top") && a("top", u($.value - P.value - m.value.mainAxis)), o.includes("bottom") && a("top", u(O.value + m.value.mainAxis)), o.includes("left") && a("left", u(w.value + m.value.crossAxis)), o.includes("right") && a("left", u(V.value - x.value + m.value.crossAxis)), o.includes("center") && a("left", u(w.value + z.value / 2 - x.value / 2 + m.value.crossAxis)), c;
128
- });
129
- X(() => e.show, (o) => {
130
- o && A();
131
- }, {
132
- flush: "post"
133
- });
134
- const I = ce(i, e.appendTo), M = Y();
135
- return ae(() => ({
136
- to: I.value
137
- }), () => te(le, k({
138
- ref: f,
139
- show: e.show,
140
- transitionProps: e.transitionProps,
141
- style: H.value
142
- }, M), {
143
- default: () => {
144
- var o;
145
- return [(o = t.content) == null ? void 0 : o.call(t)];
146
- }
147
- })), n({
148
- triggerRef: i,
149
- popperRef: b,
150
- update: A
151
- }), (o, p) => (g(), F(ee(S(s)[0]), k({
152
- ref: S(d)
153
- }, v(e.triggerEvents)), null, 16));
154
- }
155
- }), fe = /* @__PURE__ */ N(ue, [["__scopeId", "data-v-f1e25842"]]);
156
- fe.name = "TrBasePopper";
157
- export {
158
- fe as B,
159
- ae as c,
160
- ce as u
161
- };
@@ -1,233 +0,0 @@
1
- import { defineComponent as H, computed as h, ref as I, createBlock as g, openBlock as b, unref as S, createSlots as J, withCtx as r, renderSlot as i, createCommentVNode as d, normalizeProps as v, mergeProps as y, guardReactiveProps as V } from "vue";
2
- import $ from "../chat-input/index.js";
3
- import { _ as z, V as R } from "../index3.js";
4
- const k = /* @__PURE__ */ H({
5
- __name: "index",
6
- props: {
7
- autofocus: { type: Boolean },
8
- autoSize: { type: [Boolean, Object] },
9
- allowSpeech: { type: Boolean },
10
- allowFiles: { type: Boolean },
11
- clearable: { type: Boolean },
12
- disabled: { type: Boolean },
13
- defaultValue: {},
14
- loading: { type: Boolean },
15
- modelValue: {},
16
- mode: { default: "single" },
17
- maxLength: {},
18
- buttonGroup: {},
19
- submitType: { default: "enter" },
20
- speech: { type: [Boolean, Object] },
21
- placeholder: { default: "请输入内容..." },
22
- showWordLimit: { type: Boolean },
23
- suggestions: {},
24
- suggestionPopupWidth: {},
25
- activeSuggestionKeys: {},
26
- theme: {},
27
- templateData: {},
28
- stopText: {}
29
- },
30
- emits: ["update:modelValue", "update:templateData", "submit", "clear", "speech-start", "speech-end", "speech-interim", "speech-error", "suggestion-select", "focus", "blur", "escape-press", "cancel", "reset-template", "files-selected"],
31
- setup(o, { expose: W, emit: L }) {
32
- const l = o, s = L, w = h({
33
- get: () => l.modelValue ?? "",
34
- set: (e) => {
35
- s("update:modelValue", e);
36
- }
37
- }), P = h(() => l.defaultValue), c = I(), B = I(), j = h(() => {
38
- var n;
39
- const e = [];
40
- if ((n = l.suggestions) != null && n.length) {
41
- const a = $.Suggestion;
42
- a && e.push(
43
- a.configure({
44
- items: l.suggestions,
45
- popupWidth: l.suggestionPopupWidth,
46
- activeSuggestionKeys: l.activeSuggestionKeys,
47
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
- onSelect: (u) => {
49
- s("suggestion-select", u.content);
50
- }
51
- })
52
- );
53
- }
54
- const t = $.Template;
55
- return t && e.push(t.configure({})), e;
56
- }), D = h(() => {
57
- var t, n;
58
- const e = {};
59
- return (t = l.buttonGroup) != null && t.submit && (e.submit = l.buttonGroup.submit), (n = l.buttonGroup) != null && n.file && (e.clear = {
60
- disabled: l.buttonGroup.file.disabled,
61
- tooltip: l.buttonGroup.file.disabled ? "无法清空" : "清空输入"
62
- }), Object.keys(e).length > 0 ? e : void 0;
63
- }), G = h(() => {
64
- if (typeof l.speech != "boolean")
65
- return l.speech;
66
- }), K = (e) => {
67
- var a;
68
- const t = (a = c.value) == null ? void 0 : a.editor;
69
- if (!t) {
70
- console.warn("[sender-compat] Editor not ready, cannot set template data");
71
- return;
72
- }
73
- if (!e || e.length === 0) {
74
- t.commands.clearContent();
75
- return;
76
- }
77
- const n = e.map(
78
- (u) => u.type === "template" ? { ...u, type: "block" } : u
79
- );
80
- t.commands.setTemplateData(n), t.commands.focusFirstTemplate();
81
- }, O = (e) => {
82
- s("submit", e);
83
- }, A = () => {
84
- s("clear");
85
- }, N = () => {
86
- s("cancel");
87
- }, U = (e) => {
88
- s("focus", e);
89
- }, q = (e) => {
90
- s("blur", e);
91
- }, C = (e) => {
92
- s("files-selected", e);
93
- }, T = () => {
94
- s("speech-start");
95
- }, x = (e) => {
96
- s("speech-end", e);
97
- }, E = (e) => {
98
- s("speech-interim", e);
99
- }, F = (e) => {
100
- s("speech-error", e);
101
- };
102
- return W({
103
- focus: () => {
104
- var e, t;
105
- (t = (e = c.value) == null ? void 0 : e.focus) == null || t.call(e);
106
- },
107
- blur: () => {
108
- var e, t;
109
- (t = (e = c.value) == null ? void 0 : e.blur) == null || t.call(e);
110
- },
111
- clear: () => {
112
- var e, t;
113
- (t = (e = c.value) == null ? void 0 : e.clear) == null || t.call(e);
114
- },
115
- submit: () => {
116
- var e, t;
117
- (t = (e = c.value) == null ? void 0 : e.submit) == null || t.call(e);
118
- },
119
- setTemplateData: K,
120
- startSpeech: () => {
121
- var e;
122
- (e = B.value) == null || e.start();
123
- },
124
- stopSpeech: () => {
125
- var e;
126
- (e = B.value) == null || e.stop();
127
- }
128
- }), (e, t) => (b(), g(S($), {
129
- ref_key: "chatInputRef",
130
- ref: c,
131
- modelValue: w.value,
132
- "onUpdate:modelValue": [
133
- t[0] || (t[0] = (n) => w.value = n),
134
- t[1] || (t[1] = (n) => w.value = n)
135
- ],
136
- "default-value": P.value,
137
- mode: o.mode,
138
- placeholder: o.placeholder,
139
- disabled: o.disabled,
140
- loading: o.loading,
141
- "submit-type": o.submitType,
142
- "max-length": o.maxLength,
143
- "show-word-limit": o.showWordLimit,
144
- "auto-size": o.autoSize,
145
- clearable: o.clearable,
146
- autofocus: o.autofocus,
147
- extensions: j.value,
148
- "default-actions": D.value,
149
- "stop-text": o.stopText,
150
- onSubmit: O,
151
- onClear: A,
152
- onCancel: N,
153
- onFocus: U,
154
- onBlur: q
155
- }, J({
156
- "actions-inline": r((n) => {
157
- var a, u, p, m, f;
158
- return [
159
- o.allowFiles ? (b(), g(S(z), y({ key: 0 }, {
160
- ...(a = o.buttonGroup) == null ? void 0 : a.file,
161
- tooltip: (p = (u = o.buttonGroup) == null ? void 0 : u.file) == null ? void 0 : p.tooltips
162
- }, { onSelect: C }), null, 16)) : d("", !0),
163
- o.allowSpeech ? (b(), g(S(R), {
164
- key: 1,
165
- ref_key: "voiceRef",
166
- ref: B,
167
- "speech-config": G.value,
168
- icon: (f = (m = o.buttonGroup) == null ? void 0 : m.voice) == null ? void 0 : f.icon,
169
- onSpeechStart: T,
170
- onSpeechEnd: x,
171
- onSpeechInterim: E,
172
- onSpeechError: F
173
- }, null, 8, ["speech-config", "icon"])) : d("", !0),
174
- e.$slots.actions ? i(e.$slots, "actions", v(y({ key: 2 }, n))) : d("", !0)
175
- ];
176
- }),
177
- footer: r((n) => [
178
- i(e.$slots, "footer-left", v(V(n))),
179
- i(e.$slots, "footer", v(V(n)))
180
- ]),
181
- "footer-right": r((n) => {
182
- var a, u, p, m, f;
183
- return [
184
- e.$slots["footer-right"] ? i(e.$slots, "footer-right", v(y({ key: 0 }, n))) : d("", !0),
185
- o.allowFiles ? (b(), g(S(z), y({ key: 1 }, {
186
- ...(a = o.buttonGroup) == null ? void 0 : a.file,
187
- tooltip: (p = (u = o.buttonGroup) == null ? void 0 : u.file) == null ? void 0 : p.tooltips
188
- }, { onSelect: C }), null, 16)) : d("", !0),
189
- o.allowSpeech ? (b(), g(S(R), {
190
- key: 2,
191
- "speech-config": G.value,
192
- icon: (f = (m = o.buttonGroup) == null ? void 0 : m.voice) == null ? void 0 : f.icon,
193
- onSpeechStart: T,
194
- onSpeechEnd: x,
195
- onSpeechInterim: E,
196
- onSpeechError: F
197
- }, null, 8, ["speech-config", "icon"])) : d("", !0)
198
- ];
199
- }),
200
- _: 2
201
- }, [
202
- e.$slots.header ? {
203
- name: "header",
204
- fn: r(() => [
205
- i(e.$slots, "header")
206
- ]),
207
- key: "0"
208
- } : void 0,
209
- e.$slots.prefix ? {
210
- name: "prefix",
211
- fn: r(() => [
212
- i(e.$slots, "prefix")
213
- ]),
214
- key: "1"
215
- } : void 0,
216
- e.$slots.content ? {
217
- name: "content",
218
- fn: r((n) => [
219
- i(e.$slots, "content", v(V(n)))
220
- ]),
221
- key: "2"
222
- } : void 0
223
- ]), 1032, ["modelValue", "default-value", "mode", "placeholder", "disabled", "loading", "submit-type", "max-length", "show-word-limit", "auto-size", "clearable", "autofocus", "extensions", "default-actions", "stop-text"]));
224
- }
225
- });
226
- k.name = "TrSenderCompat";
227
- const M = function(o) {
228
- o.component(k.name, k);
229
- };
230
- k.install = M;
231
- export {
232
- k as default
233
- };