@opentiny/tiny-robot 0.3.1-alpha.8 → 0.3.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.
@@ -1,229 +0,0 @@
1
- import { defineComponent as H, computed as p, ref as R, openBlock as g, createBlock as b, unref as S, createSlots as J, withCtx as r, renderSlot as i, normalizeProps as y, mergeProps as k, createCommentVNode as d, guardReactiveProps as B } from "vue";
2
- import V from "../sender/index.js";
3
- import { _ as z, V as W } from "../index3.js";
4
- const w = /* @__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(t, { expose: L, emit: P }) {
32
- const c = t, l = P, $ = p({
33
- get: () => c.modelValue ?? "",
34
- set: (e) => {
35
- l("update:modelValue", e);
36
- }
37
- }), j = p(() => c.defaultValue), u = R(), v = R(), D = p(() => {
38
- var n;
39
- const e = [];
40
- if ((n = c.suggestions) != null && n.length) {
41
- const s = V.Suggestion;
42
- s && e.push(
43
- s.configure({
44
- items: c.suggestions,
45
- popupWidth: c.suggestionPopupWidth,
46
- activeSuggestionKeys: c.activeSuggestionKeys,
47
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
- onSelect: (a) => {
49
- l("suggestion-select", a.content);
50
- }
51
- })
52
- );
53
- }
54
- const o = V.Template;
55
- return o && e.push(o.configure({})), e;
56
- }), I = p(() => {
57
- var o;
58
- const e = {};
59
- return (o = c.buttonGroup) != null && o.submit && (e.submit = c.buttonGroup.submit), Object.keys(e).length > 0 ? e : void 0;
60
- }), C = p(() => {
61
- if (typeof c.speech != "boolean")
62
- return c.speech;
63
- }), K = (e) => {
64
- var s;
65
- const o = (s = u.value) == null ? void 0 : s.editor;
66
- if (!o) {
67
- console.warn("[sender-compat] Editor not ready, cannot set template data");
68
- return;
69
- }
70
- if (!e || e.length === 0) {
71
- o.commands.clearContent();
72
- return;
73
- }
74
- const n = e.map(
75
- (a) => a.type === "template" ? { ...a, type: "block" } : a
76
- );
77
- o.commands.setTemplateData(n), o.commands.focusFirstTemplate();
78
- }, O = (e) => {
79
- l("submit", e);
80
- }, A = () => {
81
- l("clear");
82
- }, N = () => {
83
- l("cancel");
84
- }, U = (e) => {
85
- l("focus", e);
86
- }, q = (e) => {
87
- l("blur", e);
88
- }, T = (e) => {
89
- l("files-selected", e);
90
- }, G = () => {
91
- l("speech-start");
92
- }, x = (e) => {
93
- l("speech-end", e);
94
- }, E = (e) => {
95
- l("speech-interim", e);
96
- }, F = (e) => {
97
- l("speech-error", e);
98
- };
99
- return L({
100
- focus: () => {
101
- var e, o;
102
- (o = (e = u.value) == null ? void 0 : e.focus) == null || o.call(e);
103
- },
104
- blur: () => {
105
- var e, o;
106
- (o = (e = u.value) == null ? void 0 : e.blur) == null || o.call(e);
107
- },
108
- clear: () => {
109
- var e, o;
110
- (o = (e = u.value) == null ? void 0 : e.clear) == null || o.call(e);
111
- },
112
- submit: () => {
113
- var e, o;
114
- (o = (e = u.value) == null ? void 0 : e.submit) == null || o.call(e);
115
- },
116
- setTemplateData: K,
117
- startSpeech: () => {
118
- var e;
119
- (e = v.value) == null || e.start();
120
- },
121
- stopSpeech: () => {
122
- var e;
123
- (e = v.value) == null || e.stop();
124
- }
125
- }), (e, o) => (g(), b(S(V), {
126
- ref_key: "senderRef",
127
- ref: u,
128
- modelValue: $.value,
129
- "onUpdate:modelValue": o[0] || (o[0] = (n) => $.value = n),
130
- "default-value": j.value,
131
- mode: t.mode,
132
- placeholder: t.placeholder,
133
- disabled: t.disabled,
134
- loading: t.loading,
135
- "submit-type": t.submitType,
136
- "max-length": t.maxLength,
137
- "show-word-limit": t.showWordLimit,
138
- "auto-size": t.autoSize,
139
- clearable: t.clearable,
140
- autofocus: t.autofocus,
141
- extensions: D.value,
142
- "default-actions": I.value,
143
- "stop-text": t.stopText,
144
- onSubmit: O,
145
- onClear: A,
146
- onCancel: N,
147
- onFocus: U,
148
- onBlur: q
149
- }, J({
150
- "actions-inline": r((n) => {
151
- var s, a, m, f, h;
152
- return [
153
- t.allowFiles && t.mode === "single" ? (g(), b(S(z), k({ key: 0 }, {
154
- ...(s = t.buttonGroup) == null ? void 0 : s.file,
155
- tooltip: (m = (a = t.buttonGroup) == null ? void 0 : a.file) == null ? void 0 : m.tooltips
156
- }, { onSelect: T }), null, 16)) : d("", !0),
157
- t.allowSpeech && t.mode === "single" ? (g(), b(S(W), {
158
- key: 1,
159
- ref_key: "voiceRef",
160
- ref: v,
161
- "speech-config": C.value,
162
- icon: (h = (f = t.buttonGroup) == null ? void 0 : f.voice) == null ? void 0 : h.icon,
163
- onSpeechStart: G,
164
- onSpeechEnd: x,
165
- onSpeechInterim: E,
166
- onSpeechError: F
167
- }, null, 8, ["speech-config", "icon"])) : d("", !0),
168
- e.$slots.actions ? i(e.$slots, "actions", y(k({ key: 2 }, n))) : d("", !0)
169
- ];
170
- }),
171
- footer: r((n) => [
172
- i(e.$slots, "footer-left", y(B(n))),
173
- i(e.$slots, "footer", y(B(n)))
174
- ]),
175
- "footer-right": r((n) => {
176
- var s, a, m, f, h;
177
- return [
178
- e.$slots["footer-right"] ? i(e.$slots, "footer-right", y(k({ key: 0 }, n))) : d("", !0),
179
- t.allowFiles && t.mode === "multiple" ? (g(), b(S(z), k({ key: 1 }, {
180
- ...(s = t.buttonGroup) == null ? void 0 : s.file,
181
- tooltip: (m = (a = t.buttonGroup) == null ? void 0 : a.file) == null ? void 0 : m.tooltips
182
- }, { onSelect: T }), null, 16)) : d("", !0),
183
- t.allowSpeech && t.mode === "multiple" ? (g(), b(S(W), {
184
- key: 2,
185
- ref_key: "voiceRef",
186
- ref: v,
187
- "speech-config": C.value,
188
- icon: (h = (f = t.buttonGroup) == null ? void 0 : f.voice) == null ? void 0 : h.icon,
189
- onSpeechStart: G,
190
- onSpeechEnd: x,
191
- onSpeechInterim: E,
192
- onSpeechError: F
193
- }, null, 8, ["speech-config", "icon"])) : d("", !0)
194
- ];
195
- }),
196
- _: 2
197
- }, [
198
- e.$slots.header ? {
199
- name: "header",
200
- fn: r(() => [
201
- i(e.$slots, "header")
202
- ]),
203
- key: "0"
204
- } : void 0,
205
- e.$slots.prefix ? {
206
- name: "prefix",
207
- fn: r(() => [
208
- i(e.$slots, "prefix")
209
- ]),
210
- key: "1"
211
- } : void 0,
212
- e.$slots.content ? {
213
- name: "content",
214
- fn: r((n) => [
215
- i(e.$slots, "content", y(B(n)))
216
- ]),
217
- key: "2"
218
- } : void 0
219
- ]), 1032, ["modelValue", "default-value", "mode", "placeholder", "disabled", "loading", "submit-type", "max-length", "show-word-limit", "auto-size", "clearable", "autofocus", "extensions", "default-actions", "stop-text"]));
220
- }
221
- });
222
- w.name = "TrSenderCompat";
223
- const M = function(t) {
224
- t.component(w.name, w);
225
- };
226
- w.install = M;
227
- export {
228
- w as default
229
- };