@sdata/web-vue 3.19.0 → 3.21.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.
Files changed (75) hide show
  1. package/dist/sd.css +11 -0
  2. package/dist/sd.min.css +1 -1
  3. package/es/basic-crud-table/basic-crud-table.vue_vue_type_script_setup_true_lang.js +6 -4
  4. package/es/basic-crud-table/types.d.ts +2 -0
  5. package/es/card/card.d.ts +22 -0
  6. package/es/card/card.js +11 -2
  7. package/es/card/index.d.ts +39 -0
  8. package/es/cascader/base-cascader-panel.d.ts +3 -0
  9. package/es/cascader/base-cascader-panel.js +2 -1
  10. package/es/cascader/cascader-search-panel.d.ts +3 -0
  11. package/es/cascader/cascader-search-panel.js +2 -1
  12. package/es/cascader/cascader.vue.d.ts +20 -8
  13. package/es/cascader/cascader.vue_vue_type_script_setup_true_lang.js +42 -4
  14. package/es/cascader/index.d.ts +1 -1
  15. package/es/cascader/types.d.ts +13 -0
  16. package/es/color-picker/color-picker.js +13 -1
  17. package/es/color-picker/index.d.ts +1 -1
  18. package/es/color-picker/interface.d.ts +10 -0
  19. package/es/config-provider/config-provider.vue.d.ts +67 -0
  20. package/es/config-provider/config-provider.vue_vue_type_script_setup_true_lang.js +67 -1
  21. package/es/config-provider/context.d.ts +12 -0
  22. package/es/config-provider/index.d.ts +99 -0
  23. package/es/date-picker/index.d.ts +12 -1
  24. package/es/date-picker/interface.d.ts +19 -0
  25. package/es/date-picker/picker.vue.d.ts +23 -13
  26. package/es/date-picker/picker.vue_vue_type_script_setup_true_lang.js +23 -2
  27. package/es/date-picker/range-picker.vue.d.ts +25 -14
  28. package/es/date-picker/range-picker.vue_vue_type_script_setup_true_lang.js +21 -2
  29. package/es/drawer/drawer.vue_vue_type_script_setup_true_lang.js +1 -1
  30. package/es/index.css +11 -0
  31. package/es/index.d.ts +2 -2
  32. package/es/list/index.d.ts +9 -0
  33. package/es/list/list.d.ts +7 -0
  34. package/es/list/list.js +8 -2
  35. package/es/modal/modal.vue_vue_type_script_setup_true_lang.js +1 -1
  36. package/es/qr-code/index.d.ts +18 -12
  37. package/es/qr-code/qr-code.vue.d.ts +5 -3
  38. package/es/qr-code/qr-code.vue_vue_type_script_setup_true_lang.js +5 -2
  39. package/es/select/index.d.ts +10 -1
  40. package/es/select/interface.d.ts +10 -0
  41. package/es/select/select-dropdown.vue.d.ts +3 -0
  42. package/es/select/select-dropdown.vue_vue_type_script_setup_true_lang.js +2 -4
  43. package/es/select/select.d.ts +7 -0
  44. package/es/select/select.js +30 -2
  45. package/es/sender/index.d.ts +1 -1
  46. package/es/sender/sender.vue_vue_type_script_setup_true_lang.js +117 -93
  47. package/es/sender/style/index.css +11 -0
  48. package/es/sender/style/index.scss +13 -0
  49. package/es/sender/types.d.ts +60 -3
  50. package/es/sender/use-speech.d.ts +12 -2
  51. package/es/sender/use-speech.js +293 -75
  52. package/es/spin/index.d.ts +15 -0
  53. package/es/spin/spin.d.ts +9 -0
  54. package/es/spin/spin.js +72 -10
  55. package/es/table/index.d.ts +51 -6
  56. package/es/table/interface.d.ts +3 -0
  57. package/es/table/table.d.ts +22 -3
  58. package/es/table/table.js +7 -2
  59. package/es/time-picker/index.d.ts +12 -1
  60. package/es/time-picker/interface.d.ts +10 -0
  61. package/es/time-picker/time-picker.vue.d.ts +15 -4
  62. package/es/time-picker/time-picker.vue_vue_type_script_setup_true_lang.js +22 -2
  63. package/es/timeline/index.d.ts +39 -0
  64. package/es/timeline/timeline.d.ts +22 -0
  65. package/es/timeline/timeline.js +11 -2
  66. package/es/toolbar/toolbar.vue_vue_type_script_setup_true_lang.js +9 -5
  67. package/es/toolbar/types.d.ts +2 -0
  68. package/es/tree-select/index.d.ts +1 -1
  69. package/es/tree-select/interface.d.ts +10 -0
  70. package/es/tree-select/tree-select.vue.d.ts +17 -1
  71. package/es/tree-select/tree-select.vue_vue_type_script_setup_true_lang.js +27 -2
  72. package/json/vetur-attributes.json +63 -3
  73. package/json/vetur-tags.json +20 -0
  74. package/json/web-types.json +163 -3
  75. package/package.json +1 -1
@@ -12,7 +12,8 @@ import IconArrowUp from "../icon/icon-arrow-up/index.js";
12
12
  import IconMute from "../icon/icon-mute/index.js";
13
13
  import IconVoice from "../icon/icon-voice/index.js";
14
14
  import { useSpeech } from "./use-speech.js";
15
- import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, getCurrentInstance, h, mergeProps, nextTick, normalizeClass, normalizeStyle, openBlock, provide, renderSlot, resolveDynamicComponent, shallowRef, toRef, unref, useAttrs, watch, withCtx } from "vue";
15
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, getCurrentInstance, h, mergeProps, nextTick, normalizeClass, normalizeStyle, openBlock, provide, renderSlot, resolveDynamicComponent, shallowRef, toRef, unref, useAttrs, watch, withCtx } from "vue";
16
+ import { createReusableTemplate } from "@vueuse/core";
16
17
  import { INSERT_LINE_BREAK_COMMAND } from "lexical";
17
18
  //#region components/sender/sender.vue?vue&type=script&setup=true&lang.ts
18
19
  var sender_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent(_objectSpread2(_objectSpread2({}, {
@@ -39,6 +40,7 @@ var sender_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
39
40
  type: Boolean,
40
41
  default: true
41
42
  },
43
+ suffixPlacement: { default: "content" },
42
44
  components: {},
43
45
  classNames: { default: () => ({}) },
44
46
  styles: { default: () => ({}) },
@@ -53,12 +55,20 @@ var sender_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
53
55
  "paste",
54
56
  "pasteFile",
55
57
  "focus",
56
- "blur"
58
+ "blur",
59
+ "speechStart",
60
+ "speechData",
61
+ "speechEnd",
62
+ "speechError",
63
+ "speechTransportOpen",
64
+ "speechTransportMessage",
65
+ "speechTransportClose"
57
66
  ],
58
67
  setup(__props, { expose: __expose, emit: __emit }) {
59
68
  const props = __props;
60
69
  const emit = __emit;
61
70
  const { t } = useI18n();
71
+ const [DefineSuffix, ReuseSuffix] = createReusableTemplate();
62
72
  const RenderContent = defineComponent({
63
73
  name: "SenderRenderContent",
64
74
  props: { content: { type: null } },
@@ -394,11 +404,14 @@ var sender_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
394
404
  if (cancelDisabled.value || props.disabled) return;
395
405
  emit("cancel");
396
406
  };
397
- const { available: speechAvailable, recording, requesting: speechRequesting, statusText: speechStatusText, trigger: triggerSpeech } = useSpeech(toRef(props, "allowSpeech"), (transcript) => {
398
- if (isSlotMode.value) {
399
- var _slotInputRef$value3;
400
- (_slotInputRef$value3 = slotInputRef.value) === null || _slotInputRef$value3 === void 0 || _slotInputRef$value3.insertText(transcript, { position: "end" });
401
- } else setNormalValue(`${mergedValue.value} ${transcript}`);
407
+ const { available: speechAvailable, recording, requesting: speechRequesting, statusText: speechStatusText, trigger: triggerSpeech } = useSpeech(toRef(props, "allowSpeech"), {
408
+ onStart: (event) => emit("speechStart", event),
409
+ onData: (event) => emit("speechData", event),
410
+ onEnd: (event) => emit("speechEnd", event),
411
+ onError: (event) => emit("speechError", event),
412
+ onTransportOpen: (event) => emit("speechTransportOpen", event),
413
+ onTransportMessage: (event) => emit("speechTransportMessage", event),
414
+ onTransportClose: (event) => emit("speechTransportClose", event)
402
415
  });
403
416
  const actionContext = computed(() => ({
404
417
  send: triggerSend,
@@ -438,10 +451,10 @@ var sender_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
438
451
  return;
439
452
  }
440
453
  if (!modifierPressed) {
441
- var _slotInputRef$value4;
454
+ var _slotInputRef$value3;
442
455
  event.preventDefault();
443
456
  event.stopPropagation();
444
- (_slotInputRef$value4 = slotInputRef.value) === null || _slotInputRef$value4 === void 0 || _slotInputRef$value4.dispatchCommand(INSERT_LINE_BREAK_COMMAND, void 0);
457
+ (_slotInputRef$value3 = slotInputRef.value) === null || _slotInputRef$value3 === void 0 || _slotInputRef$value3.dispatchCommand(INSERT_LINE_BREAK_COMMAND, void 0);
445
458
  }
446
459
  };
447
460
  const handlePaste = (event) => {
@@ -475,18 +488,18 @@ var sender_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
475
488
  const focus = (options) => {
476
489
  var _textareaRef$value, _textareaRef$value$fo, _options$cursor;
477
490
  if (isSlotMode.value) {
478
- var _slotInputRef$value6;
491
+ var _slotInputRef$value5;
479
492
  const { cursor = "end", preventScroll = false, key } = options !== null && options !== void 0 ? options : {};
480
493
  if (cursor === "slot") {
481
- var _slotInputRef$value5, _ref2;
482
- const root = (_slotInputRef$value5 = slotInputRef.value) === null || _slotInputRef$value5 === void 0 ? void 0 : _slotInputRef$value5.rootElement;
494
+ var _slotInputRef$value4, _ref2;
495
+ const root = (_slotInputRef$value4 = slotInputRef.value) === null || _slotInputRef$value4 === void 0 ? void 0 : _slotInputRef$value4.rootElement;
483
496
  const selector = key ? `[data-rich-text-component-key="${CSS.escape(key)}"]` : "[data-rich-text-component]";
484
497
  const component = root === null || root === void 0 ? void 0 : root.querySelector(selector);
485
498
  const control = component === null || component === void 0 ? void 0 : component.querySelector("input, textarea, button, [contenteditable=\"true\"]");
486
499
  (_ref2 = control !== null && control !== void 0 ? control : component) === null || _ref2 === void 0 || _ref2.focus({ preventScroll });
487
500
  return;
488
501
  }
489
- (_slotInputRef$value6 = slotInputRef.value) === null || _slotInputRef$value6 === void 0 || _slotInputRef$value6.focus(void 0, {
502
+ (_slotInputRef$value5 = slotInputRef.value) === null || _slotInputRef$value5 === void 0 || _slotInputRef$value5.focus(void 0, {
490
503
  preventScroll,
491
504
  selection: cursor === "all" ? "all" : cursor
492
505
  });
@@ -502,8 +515,8 @@ var sender_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
502
515
  else textarea.setSelectionRange(position, position);
503
516
  };
504
517
  const blur = () => {
505
- var _slotInputRef$value7;
506
- if (isSlotMode.value) (_slotInputRef$value7 = slotInputRef.value) === null || _slotInputRef$value7 === void 0 || _slotInputRef$value7.blur();
518
+ var _slotInputRef$value6;
519
+ if (isSlotMode.value) (_slotInputRef$value6 = slotInputRef.value) === null || _slotInputRef$value6 === void 0 || _slotInputRef$value6.blur();
507
520
  else {
508
521
  var _textareaRef$value2, _textareaRef$value2$b;
509
522
  const textarea = getNativeTextarea();
@@ -514,15 +527,15 @@ var sender_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
514
527
  const insert = (value, position = "cursor", replaceCharacters, preventScroll) => {
515
528
  if (isSlotMode.value) {
516
529
  if (typeof value === "string") {
517
- var _slotInputRef$value8;
518
- (_slotInputRef$value8 = slotInputRef.value) === null || _slotInputRef$value8 === void 0 || _slotInputRef$value8.insertText(value, {
530
+ var _slotInputRef$value7;
531
+ (_slotInputRef$value7 = slotInputRef.value) === null || _slotInputRef$value7 === void 0 || _slotInputRef$value7.insertText(value, {
519
532
  position,
520
533
  replaceCharacters
521
534
  });
522
535
  } else {
523
- var _slotInputRef$value9;
536
+ var _slotInputRef$value8;
524
537
  runtimeSlotConfig.value = [...runtimeSlotConfig.value, ...value];
525
- (_slotInputRef$value9 = slotInputRef.value) === null || _slotInputRef$value9 === void 0 || _slotInputRef$value9.insertContent(value.map((config) => {
538
+ (_slotInputRef$value8 = slotInputRef.value) === null || _slotInputRef$value8 === void 0 || _slotInputRef$value8.insertContent(value.map((config) => {
526
539
  var _config$value3;
527
540
  return config.type === "text" ? (_config$value3 = config.value) !== null && _config$value3 !== void 0 ? _config$value3 : "" : createSlotNode(config);
528
541
  }), {
@@ -645,8 +658,8 @@ var sender_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
645
658
  });
646
659
  __expose({
647
660
  get inputElement() {
648
- var _slotInputRef$value$r, _slotInputRef$value10;
649
- return isSlotMode.value ? (_slotInputRef$value$r = (_slotInputRef$value10 = slotInputRef.value) === null || _slotInputRef$value10 === void 0 ? void 0 : _slotInputRef$value10.rootElement) !== null && _slotInputRef$value$r !== void 0 ? _slotInputRef$value$r : null : getNativeTextarea();
661
+ var _slotInputRef$value$r, _slotInputRef$value9;
662
+ return isSlotMode.value ? (_slotInputRef$value$r = (_slotInputRef$value9 = slotInputRef.value) === null || _slotInputRef$value9 === void 0 ? void 0 : _slotInputRef$value9.rootElement) !== null && _slotInputRef$value$r !== void 0 ? _slotInputRef$value$r : null : getNativeTextarea();
650
663
  },
651
664
  get nativeElement() {
652
665
  var _containerRef$value2;
@@ -659,7 +672,67 @@ var sender_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
659
672
  getValue
660
673
  });
661
674
  return (_ctx, _cache) => {
662
- return openBlock(), createBlock(unref(Tooltip), {
675
+ return openBlock(), createElementBlock(Fragment, null, [createVNode(unref(DefineSuffix), null, {
676
+ default: withCtx(() => {
677
+ var _props$classNames, _props$styles;
678
+ return [createElementVNode("div", {
679
+ class: normalizeClass([`${unref(prefixCls)}-actions-list`, (_props$classNames = __props.classNames) === null || _props$classNames === void 0 ? void 0 : _props$classNames.suffix]),
680
+ style: normalizeStyle((_props$styles = __props.styles) === null || _props$styles === void 0 ? void 0 : _props$styles.suffix)
681
+ }, [renderSlot(_ctx.$slots, "suffix", { actions: actionContext.value }, () => [createElementVNode("div", { class: normalizeClass(`${unref(prefixCls)}-actions-list-presets`) }, [__props.allowSpeech ? (openBlock(), createBlock(unref(Button), {
682
+ key: 0,
683
+ type: "text",
684
+ loading: unref(speechRequesting),
685
+ disabled: actionContext.value.speechDisabled,
686
+ title: unref(speechStatusText),
687
+ class: normalizeClass([`${unref(prefixCls)}-actions-btn`, { [`${unref(prefixCls)}-actions-btn-disabled`]: actionContext.value.speechDisabled }]),
688
+ "aria-label": unref(speechStatusText),
689
+ onClick: _cache[0] || (_cache[0] = ($event) => unref(triggerSpeech)())
690
+ }, {
691
+ icon: withCtx(() => [unref(recording) ? (openBlock(), createBlock(unref(RecordingIcon), {
692
+ key: 0,
693
+ class: normalizeClass(`${unref(prefixCls)}-actions-btn-recording-icon`)
694
+ }, null, 8, ["class"])) : actionContext.value.speechDisabled ? (openBlock(), createBlock(unref(IconMute), { key: 1 })) : (openBlock(), createBlock(unref(IconVoice), { key: 2 }))]),
695
+ _: 1
696
+ }, 8, [
697
+ "loading",
698
+ "disabled",
699
+ "title",
700
+ "class",
701
+ "aria-label"
702
+ ])) : createCommentVNode("", true), __props.loading ? (openBlock(), createBlock(unref(Button), {
703
+ key: 1,
704
+ type: "text",
705
+ shape: "circle",
706
+ disabled: actionContext.value.cancelDisabled,
707
+ class: normalizeClass([`${unref(prefixCls)}-actions-btn`, `${unref(prefixCls)}-actions-btn-loading-button`]),
708
+ "aria-label": unref(t)("sender.stopGenerating"),
709
+ onClick: triggerCancel
710
+ }, {
711
+ icon: withCtx(() => [createVNode(unref(StopLoadingIcon), { class: normalizeClass(`${unref(prefixCls)}-actions-btn-loading-icon`) }, null, 8, ["class"])]),
712
+ _: 1
713
+ }, 8, [
714
+ "disabled",
715
+ "class",
716
+ "aria-label"
717
+ ])) : (openBlock(), createBlock(unref(Button), {
718
+ key: 2,
719
+ type: "primary",
720
+ shape: "circle",
721
+ disabled: actionContext.value.submitDisabled,
722
+ class: normalizeClass([`${unref(prefixCls)}-actions-btn`, { [`${unref(prefixCls)}-actions-btn-disabled`]: actionContext.value.submitDisabled }]),
723
+ "aria-label": unref(t)("sender.send"),
724
+ onClick: triggerSend
725
+ }, {
726
+ icon: withCtx(() => [createVNode(unref(IconArrowUp))]),
727
+ _: 1
728
+ }, 8, [
729
+ "disabled",
730
+ "class",
731
+ "aria-label"
732
+ ]))], 2)])], 6)];
733
+ }),
734
+ _: 3
735
+ }), createVNode(unref(Tooltip), {
663
736
  "popup-visible": readonlyTipVisible.value,
664
737
  content: unref(readonlyTipText),
665
738
  disabled: readonlyTipDisabled.value,
@@ -667,26 +740,26 @@ var sender_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
667
740
  onPopupVisibleChange: handleReadonlyTipVisibleChange
668
741
  }, {
669
742
  default: withCtx(() => {
670
- var _props$styles, _props$classNames, _props$styles2, _props$classNames2, _props$styles3, _props$classNames3, _props$styles4, _props$classNames4, _props$styles5, _props$classNames5, _props$styles6;
743
+ var _props$styles2, _props$classNames2, _props$styles3, _props$classNames3, _props$styles4, _props$classNames4, _props$styles5, _props$classNames5, _props$styles6;
671
744
  return [createElementVNode("div", mergeProps({
672
745
  ref_key: "containerRef",
673
746
  ref: containerRef
674
747
  }, _ctx.$attrs, {
675
748
  class: rootClass.value,
676
- style: (_props$styles = __props.styles) === null || _props$styles === void 0 ? void 0 : _props$styles.root,
749
+ style: (_props$styles2 = __props.styles) === null || _props$styles2 === void 0 ? void 0 : _props$styles2.root,
677
750
  onClick: _cache[5] || (_cache[5] = (...args) => unref(showReadonlyTip) && unref(showReadonlyTip)(...args)),
678
751
  onKeydownCapture: handleReadonlyKeydown
679
752
  }), [
680
753
  renderSlot(_ctx.$slots, "header", { actions: actionContext.value }),
681
754
  createElementVNode("div", {
682
- class: normalizeClass([`${unref(prefixCls)}-content`, (_props$classNames = __props.classNames) === null || _props$classNames === void 0 ? void 0 : _props$classNames.content]),
683
- style: normalizeStyle((_props$styles2 = __props.styles) === null || _props$styles2 === void 0 ? void 0 : _props$styles2.content),
755
+ class: normalizeClass([`${unref(prefixCls)}-content`, (_props$classNames2 = __props.classNames) === null || _props$classNames2 === void 0 ? void 0 : _props$classNames2.content]),
756
+ style: normalizeStyle((_props$styles3 = __props.styles) === null || _props$styles3 === void 0 ? void 0 : _props$styles3.content),
684
757
  onMousedown: handleContentMousedown
685
758
  }, [
686
759
  _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
687
760
  key: 0,
688
- class: normalizeClass([`${unref(prefixCls)}-prefix`, (_props$classNames2 = __props.classNames) === null || _props$classNames2 === void 0 ? void 0 : _props$classNames2.prefix]),
689
- style: normalizeStyle((_props$styles3 = __props.styles) === null || _props$styles3 === void 0 ? void 0 : _props$styles3.prefix)
761
+ class: normalizeClass([`${unref(prefixCls)}-prefix`, (_props$classNames3 = __props.classNames) === null || _props$classNames3 === void 0 ? void 0 : _props$classNames3.prefix]),
762
+ style: normalizeStyle((_props$styles4 = __props.styles) === null || _props$styles4 === void 0 ? void 0 : _props$styles4.prefix)
690
763
  }, [renderSlot(_ctx.$slots, "prefix", { actions: actionContext.value })], 6)) : createCommentVNode("", true),
691
764
  isSlotMode.value ? (openBlock(), createBlock(unref(RichTextEditor), {
692
765
  key: 1,
@@ -704,8 +777,8 @@ var sender_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
704
777
  onKeydownCapture: handleSlotKeydown,
705
778
  onKeyupCapture: __props.onKeyup,
706
779
  onPasteCapture: handleSlotPaste,
707
- onFocus: _cache[0] || (_cache[0] = ($event) => emit("focus", $event)),
708
- onBlur: _cache[1] || (_cache[1] = ($event) => emit("blur", $event))
780
+ onFocus: _cache[1] || (_cache[1] = ($event) => emit("focus", $event)),
781
+ onBlur: _cache[2] || (_cache[2] = ($event) => emit("blur", $event))
709
782
  }, {
710
783
  "node-senderSkill": withCtx(({ remove }) => [activeSkill.value ? (openBlock(), createBlock(unref(SkillTag), {
711
784
  key: 0,
@@ -774,15 +847,15 @@ var sender_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
774
847
  disabled: __props.disabled,
775
848
  readonly: __props.readonly,
776
849
  "auto-size": __props.autoSize,
777
- class: normalizeClass([`${unref(prefixCls)}-input`, (_props$classNames3 = __props.classNames) === null || _props$classNames3 === void 0 ? void 0 : _props$classNames3.input]),
778
- style: normalizeStyle((_props$styles4 = __props.styles) === null || _props$styles4 === void 0 ? void 0 : _props$styles4.input),
850
+ class: normalizeClass([`${unref(prefixCls)}-input`, (_props$classNames4 = __props.classNames) === null || _props$classNames4 === void 0 ? void 0 : _props$classNames4.input]),
851
+ style: normalizeStyle((_props$styles5 = __props.styles) === null || _props$styles5 === void 0 ? void 0 : _props$styles5.input),
779
852
  "onUpdate:modelValue": handleValueUpdate,
780
853
  onInput: handleInput,
781
854
  onKeydown: handleKeydown,
782
855
  onKeyup: __props.onKeyup,
783
856
  onPaste: handlePaste,
784
- onFocus: _cache[2] || (_cache[2] = ($event) => emit("focus", $event)),
785
- onBlur: _cache[3] || (_cache[3] = ($event) => emit("blur", $event))
857
+ onFocus: _cache[3] || (_cache[3] = ($event) => emit("focus", $event)),
858
+ onBlur: _cache[4] || (_cache[4] = ($event) => emit("blur", $event))
786
859
  }, null, 40, [
787
860
  "model-value",
788
861
  "default-value",
@@ -794,68 +867,19 @@ var sender_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
794
867
  "style",
795
868
  "onKeyup"
796
869
  ])),
797
- __props.showActions ? (openBlock(), createElementBlock("div", {
798
- key: 3,
799
- class: normalizeClass([`${unref(prefixCls)}-actions-list`, (_props$classNames4 = __props.classNames) === null || _props$classNames4 === void 0 ? void 0 : _props$classNames4.suffix]),
800
- style: normalizeStyle((_props$styles5 = __props.styles) === null || _props$styles5 === void 0 ? void 0 : _props$styles5.suffix)
801
- }, [renderSlot(_ctx.$slots, "suffix", { actions: actionContext.value }, () => [createElementVNode("div", { class: normalizeClass(`${unref(prefixCls)}-actions-list-presets`) }, [__props.allowSpeech ? (openBlock(), createBlock(unref(Button), {
802
- key: 0,
803
- type: "text",
804
- loading: unref(speechRequesting),
805
- disabled: actionContext.value.speechDisabled,
806
- title: unref(speechStatusText),
807
- class: normalizeClass([`${unref(prefixCls)}-actions-btn`, { [`${unref(prefixCls)}-actions-btn-disabled`]: actionContext.value.speechDisabled }]),
808
- "aria-label": unref(speechStatusText),
809
- onClick: _cache[4] || (_cache[4] = ($event) => unref(triggerSpeech)())
810
- }, {
811
- icon: withCtx(() => [unref(recording) ? (openBlock(), createBlock(unref(RecordingIcon), {
812
- key: 0,
813
- class: normalizeClass(`${unref(prefixCls)}-actions-btn-recording-icon`)
814
- }, null, 8, ["class"])) : actionContext.value.speechDisabled ? (openBlock(), createBlock(unref(IconMute), { key: 1 })) : (openBlock(), createBlock(unref(IconVoice), { key: 2 }))]),
815
- _: 1
816
- }, 8, [
817
- "loading",
818
- "disabled",
819
- "title",
820
- "class",
821
- "aria-label"
822
- ])) : createCommentVNode("", true), __props.loading ? (openBlock(), createBlock(unref(Button), {
823
- key: 1,
824
- type: "text",
825
- shape: "circle",
826
- disabled: actionContext.value.cancelDisabled,
827
- class: normalizeClass([`${unref(prefixCls)}-actions-btn`, `${unref(prefixCls)}-actions-btn-loading-button`]),
828
- "aria-label": unref(t)("sender.stopGenerating"),
829
- onClick: triggerCancel
830
- }, {
831
- icon: withCtx(() => [createVNode(unref(StopLoadingIcon), { class: normalizeClass(`${unref(prefixCls)}-actions-btn-loading-icon`) }, null, 8, ["class"])]),
832
- _: 1
833
- }, 8, [
834
- "disabled",
835
- "class",
836
- "aria-label"
837
- ])) : (openBlock(), createBlock(unref(Button), {
838
- key: 2,
839
- type: "primary",
840
- shape: "circle",
841
- disabled: actionContext.value.submitDisabled,
842
- class: normalizeClass([`${unref(prefixCls)}-actions-btn`, { [`${unref(prefixCls)}-actions-btn-disabled`]: actionContext.value.submitDisabled }]),
843
- "aria-label": unref(t)("sender.send"),
844
- onClick: triggerSend
845
- }, {
846
- icon: withCtx(() => [createVNode(unref(IconArrowUp))]),
847
- _: 1
848
- }, 8, [
849
- "disabled",
850
- "class",
851
- "aria-label"
852
- ]))], 2)])], 6)) : createCommentVNode("", true)
870
+ __props.showActions && __props.suffixPlacement === "content" ? (openBlock(), createBlock(unref(ReuseSuffix), { key: 3 })) : createCommentVNode("", true)
853
871
  ], 38),
854
- _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
872
+ _ctx.$slots.footer || __props.showActions && __props.suffixPlacement === "footer" ? (openBlock(), createElementBlock("div", {
855
873
  key: 0,
856
874
  class: normalizeClass([`${unref(prefixCls)}-footer`, (_props$classNames5 = __props.classNames) === null || _props$classNames5 === void 0 ? void 0 : _props$classNames5.footer]),
857
875
  style: normalizeStyle((_props$styles6 = __props.styles) === null || _props$styles6 === void 0 ? void 0 : _props$styles6.footer)
858
- }, [renderSlot(_ctx.$slots, "footer", { actions: actionContext.value })], 6)) : createCommentVNode("", true)
876
+ }, [_ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
877
+ key: 0,
878
+ class: normalizeClass(`${unref(prefixCls)}-footer-content`)
879
+ }, [renderSlot(_ctx.$slots, "footer", { actions: actionContext.value })], 2)) : createCommentVNode("", true), __props.showActions && __props.suffixPlacement === "footer" ? (openBlock(), createElementBlock("div", {
880
+ key: 1,
881
+ class: normalizeClass(`${unref(prefixCls)}-footer-suffix`)
882
+ }, [createVNode(unref(ReuseSuffix))], 2)) : createCommentVNode("", true)], 6)) : createCommentVNode("", true)
859
883
  ], 16)];
860
884
  }),
861
885
  _: 3
@@ -863,7 +887,7 @@ var sender_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
863
887
  "popup-visible",
864
888
  "content",
865
889
  "disabled"
866
- ]);
890
+ ])], 64);
867
891
  };
868
892
  }
869
893
  }));
@@ -117,10 +117,21 @@
117
117
  animation: sender-recording-bar 0.8s ease-in-out infinite;
118
118
  }
119
119
  .sd-sender-footer {
120
+ display: flex;
121
+ gap: 8px;
122
+ align-items: center;
120
123
  box-sizing: border-box;
121
124
  padding-block: 4px 12px;
122
125
  padding-inline: 12px;
123
126
  }
127
+ .sd-sender-footer-content {
128
+ flex: auto;
129
+ min-width: 0;
130
+ }
131
+ .sd-sender-footer-suffix {
132
+ flex: none;
133
+ margin-inline-start: auto;
134
+ }
124
135
  .sd-sender-header {
125
136
  overflow: hidden;
126
137
  border-bottom: 1px solid color-mix(in srgb, var(--sd-color-neutral-3) 10%, transparent);
@@ -128,9 +128,22 @@ $sender-prefix-cls: string.unquote('#{theme.$prefix}-sender');
128
128
  }
129
129
 
130
130
  &-footer {
131
+ display: flex;
132
+ gap: $sender-content-gap;
133
+ align-items: center;
131
134
  box-sizing: border-box;
132
135
  padding-block: $sender-footer-padding-top $sender-padding-block;
133
136
  padding-inline: $sender-padding-inline;
137
+
138
+ &-content {
139
+ flex: auto;
140
+ min-width: 0;
141
+ }
142
+
143
+ &-suffix {
144
+ flex: none;
145
+ margin-inline-start: auto;
146
+ }
134
147
  }
135
148
 
136
149
  &-header {
@@ -2,15 +2,64 @@ import type { CSSProperties, Component, VNodeChild } from 'vue';
2
2
  import type { TooltipProps } from '../tooltip';
3
3
  export type SenderSubmitType = 'enter' | 'shiftEnter';
4
4
  export type SenderInsertPosition = 'start' | 'end' | 'cursor';
5
+ export type SenderSuffixPlacement = 'content' | 'footer';
5
6
  export type SenderSemanticType = 'root' | 'prefix' | 'input' | 'suffix' | 'footer' | 'switch' | 'content';
6
7
  export interface SenderComponents {
7
8
  input?: Component;
8
9
  }
9
- export interface SenderControlledSpeechConfig {
10
+ export interface SenderSpeechConfig {
10
11
  recording?: boolean;
11
- onRecordingChange: (recording: boolean) => void;
12
+ onRecordingChange?: (recording: boolean) => void;
13
+ audioConstraints?: MediaTrackConstraints;
14
+ bufferSize?: number;
15
+ workletUrl?: string;
16
+ processorName?: string;
17
+ processorOptions?: Record<string, unknown>;
18
+ url?: string;
19
+ protocols?: string | string[];
20
+ sendMetadata?: boolean;
21
+ }
22
+ export type SenderControlledSpeechConfig = SenderSpeechConfig;
23
+ export type SenderAllowSpeech = boolean | SenderSpeechConfig;
24
+ export interface SenderSpeechStartEvent {
25
+ source: 'capture' | 'controlled';
26
+ startedAt: number;
27
+ stream?: MediaStream;
28
+ audioContext?: AudioContext;
29
+ sampleRate?: number;
30
+ }
31
+ export interface SenderSpeechDataEvent {
32
+ buffer: ArrayBuffer;
33
+ sampleRate: number;
34
+ sequence: number;
35
+ timestamp: number;
36
+ }
37
+ export type SenderSpeechEndReason = 'manual' | 'controlled' | 'error' | 'unmount';
38
+ export interface SenderSpeechEndEvent {
39
+ source: 'capture' | 'controlled';
40
+ reason: SenderSpeechEndReason;
41
+ startedAt: number;
42
+ endedAt: number;
43
+ duration: number;
44
+ chunks: number;
45
+ }
46
+ export type SenderSpeechErrorPhase = 'permission' | 'audioContext' | 'audioWorklet' | 'transport';
47
+ export interface SenderSpeechErrorEvent {
48
+ error: Error;
49
+ phase: SenderSpeechErrorPhase;
50
+ }
51
+ export interface SenderSpeechTransportOpenEvent {
52
+ event: Event;
53
+ socket: WebSocket;
54
+ }
55
+ export interface SenderSpeechTransportMessageEvent {
56
+ event: MessageEvent;
57
+ socket: WebSocket;
58
+ }
59
+ export interface SenderSpeechTransportCloseEvent {
60
+ event: CloseEvent;
61
+ socket: WebSocket;
12
62
  }
13
- export type SenderAllowSpeech = boolean | SenderControlledSpeechConfig;
14
63
  export interface SenderSkillClosableConfig {
15
64
  closeIcon?: VNodeChild;
16
65
  onClose?: (event: MouseEvent) => void;
@@ -131,6 +180,7 @@ export interface SenderProps {
131
180
  skill?: SenderSkill;
132
181
  placeholder?: string;
133
182
  showActions?: boolean;
183
+ suffixPlacement?: SenderSuffixPlacement;
134
184
  components?: SenderComponents;
135
185
  classNames?: Partial<Record<SenderSemanticType, string>>;
136
186
  styles?: Partial<Record<SenderSemanticType, CSSProperties>>;
@@ -151,6 +201,13 @@ export interface SenderEmits {
151
201
  'pasteFile': [files: FileList];
152
202
  'focus': [event: FocusEvent];
153
203
  'blur': [event: FocusEvent];
204
+ 'speechStart': [event: SenderSpeechStartEvent];
205
+ 'speechData': [event: SenderSpeechDataEvent];
206
+ 'speechEnd': [event: SenderSpeechEndEvent];
207
+ 'speechError': [event: SenderSpeechErrorEvent];
208
+ 'speechTransportOpen': [event: SenderSpeechTransportOpenEvent];
209
+ 'speechTransportMessage': [event: SenderSpeechTransportMessageEvent];
210
+ 'speechTransportClose': [event: SenderSpeechTransportCloseEvent];
154
211
  }
155
212
  export type SenderHeaderSemanticType = 'header' | 'content';
156
213
  export interface SenderHeaderProps {
@@ -1,9 +1,19 @@
1
1
  import { type MaybeRefOrGetter } from 'vue';
2
- import type { SenderAllowSpeech } from './types';
3
- export declare function useSpeech(allowSpeech: MaybeRefOrGetter<SenderAllowSpeech | undefined>, onTranscript: (transcript: string) => void): {
2
+ import type { SenderAllowSpeech, SenderSpeechDataEvent, SenderSpeechEndEvent, SenderSpeechErrorEvent, SenderSpeechStartEvent, SenderSpeechTransportCloseEvent, SenderSpeechTransportMessageEvent, SenderSpeechTransportOpenEvent } from './types';
3
+ interface UseSpeechOptions {
4
+ onStart: (event: SenderSpeechStartEvent) => void;
5
+ onData: (event: SenderSpeechDataEvent) => void;
6
+ onEnd: (event: SenderSpeechEndEvent) => void;
7
+ onError: (event: SenderSpeechErrorEvent) => void;
8
+ onTransportOpen: (event: SenderSpeechTransportOpenEvent) => void;
9
+ onTransportMessage: (event: SenderSpeechTransportMessageEvent) => void;
10
+ onTransportClose: (event: SenderSpeechTransportCloseEvent) => void;
11
+ }
12
+ export declare function useSpeech(allowSpeech: MaybeRefOrGetter<SenderAllowSpeech | undefined>, options: UseSpeechOptions): {
4
13
  available: import("vue").ComputedRef<boolean>;
5
14
  recording: import("vue").ComputedRef<boolean>;
6
15
  requesting: import("vue").ShallowRef<boolean, boolean>;
7
16
  statusText: import("vue").ComputedRef<string>;
8
17
  trigger: (breakRecording?: boolean) => Promise<void>;
9
18
  };
19
+ export {};