@opentiny/tiny-robot 0.5.2-alpha.6 → 0.5.2-alpha.8
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.d.ts +55 -51
- package/dist/index3.js +95 -92
- package/dist/sender/index.js +1129 -1115
- package/dist/style.css +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -241,21 +241,7 @@ setContent: (content: string) => void;
|
|
|
241
241
|
getContent: () => string;
|
|
242
242
|
editor: Editor | undefined;
|
|
243
243
|
} & {} & ComponentCustomProperties & {} & {
|
|
244
|
-
$slots:
|
|
245
|
-
header?(_: {}): any;
|
|
246
|
-
header?(_: {}): any;
|
|
247
|
-
prefix?(_: {}): any;
|
|
248
|
-
prefix?(_: {}): any;
|
|
249
|
-
content?(_: {
|
|
250
|
-
editor: Editor | undefined;
|
|
251
|
-
}): any;
|
|
252
|
-
content?(_: {
|
|
253
|
-
editor: Ref<Editor | undefined, Editor | undefined>;
|
|
254
|
-
}): any;
|
|
255
|
-
'actions-inline'?(_: {}): any;
|
|
256
|
-
footer?(_: {}): any;
|
|
257
|
-
'footer-right'?(_: {}): any;
|
|
258
|
-
};
|
|
244
|
+
$slots: Readonly<SenderSlots> & SenderSlots;
|
|
259
245
|
}) | null;
|
|
260
246
|
voiceRef: ({
|
|
261
247
|
$: ComponentInternalInstance;
|
|
@@ -1041,12 +1027,52 @@ declare function __VLS_template_11(): {
|
|
|
1041
1027
|
header?(_: {}): any;
|
|
1042
1028
|
prefix?(_: {}): any;
|
|
1043
1029
|
content?(_: {
|
|
1044
|
-
editor:
|
|
1030
|
+
editor: unknown;
|
|
1031
|
+
}): any;
|
|
1032
|
+
actions?(_: {
|
|
1033
|
+
editor: Editor_2 | undefined;
|
|
1034
|
+
focus: () => void;
|
|
1035
|
+
blur: () => void;
|
|
1036
|
+
insert: (content: string) => void;
|
|
1037
|
+
append: (content: string) => void;
|
|
1038
|
+
replace: (content: string) => void;
|
|
1039
|
+
disabled: boolean;
|
|
1040
|
+
loading: boolean;
|
|
1041
|
+
hasContent: boolean;
|
|
1042
|
+
}): any;
|
|
1043
|
+
'footer-left'?(_: {
|
|
1044
|
+
editor: Editor_2 | undefined;
|
|
1045
|
+
focus: () => void;
|
|
1046
|
+
blur: () => void;
|
|
1047
|
+
insert: (content: string) => void;
|
|
1048
|
+
append: (content: string) => void;
|
|
1049
|
+
replace: (content: string) => void;
|
|
1050
|
+
disabled: boolean;
|
|
1051
|
+
loading: boolean;
|
|
1052
|
+
hasContent: boolean;
|
|
1053
|
+
}): any;
|
|
1054
|
+
footer?(_: {
|
|
1055
|
+
editor: Editor_2 | undefined;
|
|
1056
|
+
focus: () => void;
|
|
1057
|
+
blur: () => void;
|
|
1058
|
+
insert: (content: string) => void;
|
|
1059
|
+
append: (content: string) => void;
|
|
1060
|
+
replace: (content: string) => void;
|
|
1061
|
+
disabled: boolean;
|
|
1062
|
+
loading: boolean;
|
|
1063
|
+
hasContent: boolean;
|
|
1064
|
+
}): any;
|
|
1065
|
+
'footer-right'?(_: {
|
|
1066
|
+
editor: Editor_2 | undefined;
|
|
1067
|
+
focus: () => void;
|
|
1068
|
+
blur: () => void;
|
|
1069
|
+
insert: (content: string) => void;
|
|
1070
|
+
append: (content: string) => void;
|
|
1071
|
+
replace: (content: string) => void;
|
|
1072
|
+
disabled: boolean;
|
|
1073
|
+
loading: boolean;
|
|
1074
|
+
hasContent: boolean;
|
|
1045
1075
|
}): any;
|
|
1046
|
-
actions?(_: {}): any;
|
|
1047
|
-
'footer-left'?(_: {}): any;
|
|
1048
|
-
footer?(_: {}): any;
|
|
1049
|
-
'footer-right'?(_: {}): any;
|
|
1050
1076
|
};
|
|
1051
1077
|
refs: {
|
|
1052
1078
|
senderRef: ({
|
|
@@ -1172,21 +1198,7 @@ declare function __VLS_template_11(): {
|
|
|
1172
1198
|
getContent: () => string;
|
|
1173
1199
|
editor: Editor | undefined;
|
|
1174
1200
|
} & {} & ComponentCustomProperties & {} & {
|
|
1175
|
-
$slots:
|
|
1176
|
-
header?(_: {}): any;
|
|
1177
|
-
header?(_: {}): any;
|
|
1178
|
-
prefix?(_: {}): any;
|
|
1179
|
-
prefix?(_: {}): any;
|
|
1180
|
-
content?(_: {
|
|
1181
|
-
editor: Editor | undefined;
|
|
1182
|
-
}): any;
|
|
1183
|
-
content?(_: {
|
|
1184
|
-
editor: Ref<Editor | undefined, Editor | undefined>;
|
|
1185
|
-
}): any;
|
|
1186
|
-
'actions-inline'?(_: {}): any;
|
|
1187
|
-
footer?(_: {}): any;
|
|
1188
|
-
'footer-right'?(_: {}): any;
|
|
1189
|
-
};
|
|
1201
|
+
$slots: Readonly<SenderSlots> & SenderSlots;
|
|
1190
1202
|
}) | null;
|
|
1191
1203
|
voiceRef: ({
|
|
1192
1204
|
$: ComponentInternalInstance;
|
|
@@ -2573,7 +2585,7 @@ export { _default_20 as ClearButton }
|
|
|
2573
2585
|
export { _default_20 as TrClearButton }
|
|
2574
2586
|
|
|
2575
2587
|
declare const _default_21: DefineComponent<UploadButtonProps, {
|
|
2576
|
-
open: (
|
|
2588
|
+
open: (options?: Parameters<typeof openFileDialog>[0]) => void;
|
|
2577
2589
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
2578
2590
|
error: (error: Error, files?: File[] | undefined) => any;
|
|
2579
2591
|
select: (files: File[]) => any;
|
|
@@ -3495,6 +3507,8 @@ declare type MentionStructuredItem = {
|
|
|
3495
3507
|
value: string;
|
|
3496
3508
|
};
|
|
3497
3509
|
|
|
3510
|
+
declare const openFileDialog: (localOptions?: Partial<UseFileDialogOptions>) => void;
|
|
3511
|
+
|
|
3498
3512
|
export declare type PluginAddState = 'idle' | 'loading' | 'added';
|
|
3499
3513
|
|
|
3500
3514
|
export declare interface PluginCardEmits {
|
|
@@ -3773,21 +3787,7 @@ hasExternalContent: boolean;
|
|
|
3773
3787
|
extensions: Extension[] | any[];
|
|
3774
3788
|
submitType: SubmitTrigger;
|
|
3775
3789
|
}, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & VNodeProps & AllowedComponentProps & ComponentCustomProps & (new () => {
|
|
3776
|
-
$slots:
|
|
3777
|
-
header?(_: {}): any;
|
|
3778
|
-
header?(_: {}): any;
|
|
3779
|
-
prefix?(_: {}): any;
|
|
3780
|
-
prefix?(_: {}): any;
|
|
3781
|
-
content?(_: {
|
|
3782
|
-
editor: Editor | undefined;
|
|
3783
|
-
}): any;
|
|
3784
|
-
content?(_: {
|
|
3785
|
-
editor: Ref<Editor | undefined, Editor | undefined>;
|
|
3786
|
-
}): any;
|
|
3787
|
-
'actions-inline'?(_: {}): any;
|
|
3788
|
-
footer?(_: {}): any;
|
|
3789
|
-
'footer-right'?(_: {}): any;
|
|
3790
|
-
};
|
|
3790
|
+
$slots: Readonly<SenderSlots> & SenderSlots;
|
|
3791
3791
|
}) & {
|
|
3792
3792
|
install: <T>(app: App<T>) => void;
|
|
3793
3793
|
Mention: Node_2<MentionOptions, any>;
|
|
@@ -5012,6 +5012,10 @@ declare interface TemplateOptions {
|
|
|
5012
5012
|
* ```
|
|
5013
5013
|
*/
|
|
5014
5014
|
items?: TemplateItem[] | Ref<TemplateItem[]>;
|
|
5015
|
+
/**
|
|
5016
|
+
* Template Select 下拉菜单的 Teleport 目标
|
|
5017
|
+
*/
|
|
5018
|
+
appendTo?: string | HTMLElement;
|
|
5015
5019
|
/**
|
|
5016
5020
|
* HTML 属性
|
|
5017
5021
|
*/
|
package/dist/index3.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var $ = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
import { e as
|
|
6
|
-
import { u as
|
|
7
|
-
import { IconImageUpload as
|
|
8
|
-
import { _ as
|
|
9
|
-
const
|
|
2
|
+
var F = (i, o, e) => o in i ? $(i, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[o] = e;
|
|
3
|
+
var x = (i, o, e) => F(i, typeof o != "symbol" ? o + "" : o, e);
|
|
4
|
+
import { defineComponent as I, toRefs as H, computed as v, watch as V, openBlock as R, createBlock as y, unref as m, ref as A, reactive as P, onUnmounted as j, createElementBlock as U, Fragment as W, normalizeClass as L, createSlots as M, withCtx as z, renderSlot as B, resolveDynamicComponent as N, createCommentVNode as O } from "vue";
|
|
5
|
+
import { e as T } from "./index4.js";
|
|
6
|
+
import { u as b, A as k } from "./index2.js";
|
|
7
|
+
import { IconImageUpload as _, IconVoice as q, IconRecordingWave as G } from "@opentiny/tiny-robot-svgs";
|
|
8
|
+
import { _ as J } from "./_plugin-vue_export-helper.js";
|
|
9
|
+
const ne = /* @__PURE__ */ I({
|
|
10
10
|
__name: "index",
|
|
11
11
|
props: {
|
|
12
12
|
disabled: { type: Boolean },
|
|
@@ -22,48 +22,51 @@ const te = /* @__PURE__ */ B({
|
|
|
22
22
|
},
|
|
23
23
|
emits: ["select", "error"],
|
|
24
24
|
setup(i, { expose: o, emit: e }) {
|
|
25
|
-
const n = i, l = e, { accept: c, multiple:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
const n = i, l = e, { accept: c, multiple: g, reset: f } = H(n), { disabled: a } = b(), t = v(() => n.disabled || a.value), { open: s, files: d } = T(), u = (p) => {
|
|
26
|
+
s({
|
|
27
|
+
accept: c.value,
|
|
28
|
+
multiple: g.value,
|
|
29
|
+
reset: f.value,
|
|
30
|
+
...p
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
V(d, (p) => {
|
|
34
|
+
if (!p || p.length === 0) return;
|
|
35
|
+
const r = Array.from(p);
|
|
36
|
+
if (n.maxCount && r.length > n.maxCount) {
|
|
37
|
+
const h = new Error(`最多只能选择 ${n.maxCount} 个文件`);
|
|
38
|
+
l("error", h);
|
|
36
39
|
return;
|
|
37
40
|
}
|
|
38
41
|
if (n.maxSize) {
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
41
|
-
const
|
|
42
|
-
l("error",
|
|
42
|
+
const h = n.maxSize * 1024 * 1024, E = r.filter((C) => C.size > h);
|
|
43
|
+
if (E.length > 0) {
|
|
44
|
+
const C = new Error(`以下文件超过 ${n.maxSize}MB 限制: ${E.map((D) => D.name).join(", ")}`);
|
|
45
|
+
l("error", C, E);
|
|
43
46
|
return;
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
|
-
l("select",
|
|
49
|
+
l("select", r);
|
|
47
50
|
});
|
|
48
|
-
const
|
|
49
|
-
t.value ||
|
|
51
|
+
const w = () => {
|
|
52
|
+
t.value || u();
|
|
50
53
|
};
|
|
51
54
|
return o({
|
|
52
|
-
open:
|
|
53
|
-
}), (
|
|
54
|
-
icon: i.icon ??
|
|
55
|
+
open: u
|
|
56
|
+
}), (p, r) => (R(), y(k, {
|
|
57
|
+
icon: i.icon ?? m(_),
|
|
55
58
|
disabled: t.value,
|
|
56
59
|
size: i.size,
|
|
57
60
|
tooltip: i.tooltip,
|
|
58
61
|
"tooltip-placement": i.tooltipPlacement,
|
|
59
|
-
onClick:
|
|
62
|
+
onClick: w
|
|
60
63
|
}, null, 8, ["icon", "disabled", "size", "tooltip", "tooltip-placement"]));
|
|
61
64
|
}
|
|
62
65
|
});
|
|
63
|
-
class
|
|
66
|
+
class S {
|
|
64
67
|
constructor(o) {
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
x(this, "recognition");
|
|
69
|
+
x(this, "options");
|
|
67
70
|
this.options = o, this.initialize();
|
|
68
71
|
}
|
|
69
72
|
/**
|
|
@@ -82,7 +85,7 @@ class w {
|
|
|
82
85
|
* 检查浏览器是否支持 Web Speech API(实例方法)
|
|
83
86
|
*/
|
|
84
87
|
isSupported() {
|
|
85
|
-
return
|
|
88
|
+
return S.isSupported();
|
|
86
89
|
}
|
|
87
90
|
/**
|
|
88
91
|
* 设置语音识别事件处理器
|
|
@@ -136,8 +139,8 @@ class w {
|
|
|
136
139
|
}
|
|
137
140
|
}
|
|
138
141
|
}
|
|
139
|
-
function
|
|
140
|
-
const o =
|
|
142
|
+
function K(i) {
|
|
143
|
+
const o = A(i), e = P({
|
|
141
144
|
isRecording: !1,
|
|
142
145
|
isSupported: !1,
|
|
143
146
|
error: void 0
|
|
@@ -147,25 +150,25 @@ function J(i) {
|
|
|
147
150
|
e.isRecording = !0, e.error = void 0, (t = (a = o.value).onStart) == null || t.call(a);
|
|
148
151
|
},
|
|
149
152
|
onInterim: (a) => {
|
|
150
|
-
var t,
|
|
151
|
-
(
|
|
153
|
+
var t, s;
|
|
154
|
+
(s = (t = o.value).onInterim) == null || s.call(t, a);
|
|
152
155
|
},
|
|
153
156
|
onFinal: (a) => {
|
|
154
|
-
var t,
|
|
155
|
-
(
|
|
157
|
+
var t, s;
|
|
158
|
+
(s = (t = o.value).onFinal) == null || s.call(t, a);
|
|
156
159
|
},
|
|
157
160
|
onEnd: (a) => {
|
|
158
|
-
var t,
|
|
159
|
-
e.isRecording && (e.isRecording = !1, (
|
|
161
|
+
var t, s;
|
|
162
|
+
e.isRecording && (e.isRecording = !1, (s = (t = o.value).onEnd) == null || s.call(t, a));
|
|
160
163
|
},
|
|
161
164
|
onError: (a) => {
|
|
162
|
-
var t,
|
|
163
|
-
e.error = a, e.isRecording = !1, (
|
|
165
|
+
var t, s;
|
|
166
|
+
e.error = a, e.isRecording = !1, (s = (t = o.value).onError) == null || s.call(t, a);
|
|
164
167
|
}
|
|
165
|
-
}, l =
|
|
168
|
+
}, l = S.isSupported();
|
|
166
169
|
e.isSupported = i.customHandler ? i.customHandler.isSupported() : l;
|
|
167
|
-
const c = i.customHandler ?? (l ? new
|
|
168
|
-
var a, t,
|
|
170
|
+
const c = i.customHandler ?? (l ? new S(i) : null), g = () => {
|
|
171
|
+
var a, t, s, d;
|
|
169
172
|
if (!e.isSupported || !c) {
|
|
170
173
|
const u = new Error("语音识别不受支持");
|
|
171
174
|
e.error = u, (t = (a = o.value).onError) == null || t.call(a, u);
|
|
@@ -180,20 +183,20 @@ function J(i) {
|
|
|
180
183
|
try {
|
|
181
184
|
c.start(n);
|
|
182
185
|
} catch (u) {
|
|
183
|
-
e.error = u instanceof Error ? u : new Error("启动失败"), (d = (
|
|
186
|
+
e.error = u instanceof Error ? u : new Error("启动失败"), (d = (s = o.value).onError) == null || d.call(s, e.error);
|
|
184
187
|
}
|
|
185
|
-
},
|
|
188
|
+
}, f = () => {
|
|
186
189
|
!e.isRecording || !c || (c.stop(), n.onEnd());
|
|
187
190
|
};
|
|
188
|
-
return
|
|
191
|
+
return j(() => {
|
|
189
192
|
e.isRecording && c && (c.stop(), e.isRecording = !1);
|
|
190
193
|
}), {
|
|
191
194
|
speechState: e,
|
|
192
|
-
start:
|
|
193
|
-
stop:
|
|
195
|
+
start: g,
|
|
196
|
+
stop: f
|
|
194
197
|
};
|
|
195
198
|
}
|
|
196
|
-
const
|
|
199
|
+
const Q = /* @__PURE__ */ I({
|
|
197
200
|
__name: "index",
|
|
198
201
|
props: {
|
|
199
202
|
icon: {},
|
|
@@ -208,75 +211,75 @@ const K = /* @__PURE__ */ B({
|
|
|
208
211
|
},
|
|
209
212
|
emits: ["speech-start", "speech-interim", "speech-final", "speech-end", "speech-error"],
|
|
210
213
|
setup(i, { expose: o, emit: e }) {
|
|
211
|
-
const n = i, l = e, { editor: c, disabled:
|
|
214
|
+
const n = i, l = e, { editor: c, disabled: g } = b(), f = v(() => n.disabled || g.value), a = {
|
|
212
215
|
...n.speechConfig,
|
|
213
216
|
onStart: () => {
|
|
214
217
|
l("speech-start");
|
|
215
218
|
},
|
|
216
|
-
onInterim: (
|
|
217
|
-
l("speech-interim",
|
|
219
|
+
onInterim: (r) => {
|
|
220
|
+
l("speech-interim", r);
|
|
218
221
|
},
|
|
219
|
-
onFinal: (
|
|
220
|
-
n.autoInsert && c.value && (c.value.commands.insertContent(
|
|
222
|
+
onFinal: (r) => {
|
|
223
|
+
n.autoInsert && c.value && (c.value.commands.insertContent(r + " "), c.value.commands.focus("end")), l("speech-final", r);
|
|
221
224
|
},
|
|
222
|
-
onEnd: (
|
|
223
|
-
c.value && c.value.commands.focus("end"), l("speech-end",
|
|
225
|
+
onEnd: (r) => {
|
|
226
|
+
c.value && c.value.commands.focus("end"), l("speech-end", r);
|
|
224
227
|
},
|
|
225
|
-
onError: (
|
|
226
|
-
l("speech-error",
|
|
228
|
+
onError: (r) => {
|
|
229
|
+
l("speech-error", r);
|
|
227
230
|
}
|
|
228
|
-
}, { speechState: t, start:
|
|
229
|
-
if (!
|
|
231
|
+
}, { speechState: t, start: s, stop: d } = K(a), u = async () => {
|
|
232
|
+
if (!f.value) {
|
|
230
233
|
if (n.onButtonClick) {
|
|
231
|
-
let
|
|
234
|
+
let r = !1;
|
|
232
235
|
if (await n.onButtonClick(t.isRecording, () => {
|
|
233
|
-
|
|
234
|
-
}),
|
|
236
|
+
r = !0;
|
|
237
|
+
}), r) return;
|
|
235
238
|
}
|
|
236
|
-
t.isRecording ? d() :
|
|
239
|
+
t.isRecording ? d() : s();
|
|
237
240
|
}
|
|
238
|
-
},
|
|
241
|
+
}, w = v(() => n.icon ?? q), p = v(() => n.recordingIcon ?? G);
|
|
239
242
|
return o({
|
|
240
|
-
start:
|
|
243
|
+
start: s,
|
|
241
244
|
stop: d,
|
|
242
245
|
speechState: t
|
|
243
|
-
}), (
|
|
244
|
-
|
|
246
|
+
}), (r, h) => (R(), U(W, null, [
|
|
247
|
+
m(t).isSupported ? (R(), y(k, {
|
|
245
248
|
key: 0,
|
|
246
|
-
icon:
|
|
247
|
-
disabled:
|
|
249
|
+
icon: w.value,
|
|
250
|
+
disabled: f.value,
|
|
248
251
|
size: i.size,
|
|
249
252
|
tooltip: i.tooltip,
|
|
250
253
|
"tooltip-placement": i.tooltipPlacement,
|
|
251
|
-
class:
|
|
254
|
+
class: L({ "is-recording": m(t).isRecording }),
|
|
252
255
|
onClick: u
|
|
253
|
-
},
|
|
254
|
-
|
|
256
|
+
}, M({ _: 2 }, [
|
|
257
|
+
r.$slots.icon ? {
|
|
255
258
|
name: "icon",
|
|
256
|
-
fn:
|
|
257
|
-
|
|
258
|
-
isRecording:
|
|
259
|
+
fn: z(() => [
|
|
260
|
+
B(r.$slots, "icon", {
|
|
261
|
+
isRecording: m(t).isRecording
|
|
259
262
|
}, void 0, !0)
|
|
260
263
|
]),
|
|
261
264
|
key: "0"
|
|
262
|
-
} :
|
|
265
|
+
} : m(t).isRecording ? {
|
|
263
266
|
name: "icon",
|
|
264
|
-
fn:
|
|
265
|
-
(
|
|
267
|
+
fn: z(() => [
|
|
268
|
+
(R(), y(N(p.value)))
|
|
266
269
|
]),
|
|
267
270
|
key: "1"
|
|
268
271
|
} : void 0
|
|
269
|
-
]), 1032, ["icon", "disabled", "size", "tooltip", "tooltip-placement", "class"])) :
|
|
270
|
-
|
|
271
|
-
isRecording:
|
|
272
|
-
stop:
|
|
272
|
+
]), 1032, ["icon", "disabled", "size", "tooltip", "tooltip-placement", "class"])) : O("", !0),
|
|
273
|
+
B(r.$slots, "recording-overlay", {
|
|
274
|
+
isRecording: m(t).isRecording,
|
|
275
|
+
stop: m(d)
|
|
273
276
|
}, void 0, !0)
|
|
274
277
|
], 64));
|
|
275
278
|
}
|
|
276
|
-
}),
|
|
279
|
+
}), ie = /* @__PURE__ */ J(Q, [["__scopeId", "data-v-2a013fc9"]]);
|
|
277
280
|
export {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
281
|
+
ie as V,
|
|
282
|
+
S as W,
|
|
283
|
+
ne as _,
|
|
284
|
+
K as u
|
|
282
285
|
};
|