@opentiny/tiny-robot 0.5.2-alpha.8 → 0.5.2-rc.0

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