@progress/kendo-vue-conversational-ui 6.4.1 → 6.5.0-develop.1
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/ai-prompt/views/AIPromptOutputView.mjs +5 -5
- package/dist/cdn/js/kendo-vue-conversational-ui.js +1 -1
- package/index.d.mts +266 -0
- package/index.d.ts +266 -0
- package/index.js +1 -1
- package/index.mjs +21 -18
- package/package.json +6 -6
- package/speech-to-text/SpeechToTextButton.js +8 -0
- package/speech-to-text/SpeechToTextButton.mjs +198 -0
|
@@ -10,7 +10,7 @@ import { AIPromptContent as I } from "../AIPromptContent.mjs";
|
|
|
10
10
|
import { aIPromptNoOutputs as d, messages as C } from "../../messages/main.mjs";
|
|
11
11
|
import { AIPromptViewRender as b } from "./AIPromptViewRender.mjs";
|
|
12
12
|
import { Card as m, CardHeader as v, CardTitle as R, CardSubtitle as P, CardBody as c, CardActions as k } from "@progress/kendo-vue-layout";
|
|
13
|
-
import { commentIcon as T, copyIcon as a,
|
|
13
|
+
import { commentIcon as T, copyIcon as a, rotateIcon as w, thumbUpOutlineIcon as A, thumbDownOutlineIcon as O, checkIcon as B } from "@progress/kendo-svg-icons";
|
|
14
14
|
import { Button as i } from "@progress/kendo-vue-buttons";
|
|
15
15
|
import { provideLocalizationService as S } from "@progress/kendo-vue-intl";
|
|
16
16
|
import { templateRendering as z, getListeners as V, getTemplate as j } from "@progress/kendo-vue-common";
|
|
@@ -58,7 +58,7 @@ const q = {
|
|
|
58
58
|
});
|
|
59
59
|
},
|
|
60
60
|
copyToClipboard(e, n) {
|
|
61
|
-
e != null && e.responseContent && navigator.clipboard.writeText(e.responseContent), this.copiedIndex = n, this.copyButtonIcon =
|
|
61
|
+
e != null && e.responseContent && navigator.clipboard.writeText(e.responseContent), this.copiedIndex = n, this.copyButtonIcon = B, this.$emit("copy", e == null ? void 0 : e.responseContent), setTimeout(() => {
|
|
62
62
|
this.copyButtonIcon = a, this.copiedIndex = -1;
|
|
63
63
|
}, 1e3);
|
|
64
64
|
},
|
|
@@ -124,7 +124,7 @@ const q = {
|
|
|
124
124
|
fillMode: "flat",
|
|
125
125
|
rounded: "medium",
|
|
126
126
|
title: "Retry",
|
|
127
|
-
svgIcon:
|
|
127
|
+
svgIcon: w,
|
|
128
128
|
"aria-hidden": "true",
|
|
129
129
|
onClick: () => this.retryPrompt(o, l)
|
|
130
130
|
}, {
|
|
@@ -138,7 +138,7 @@ const q = {
|
|
|
138
138
|
fillMode: "flat",
|
|
139
139
|
rounded: "medium",
|
|
140
140
|
title: "Rate up",
|
|
141
|
-
svgIcon:
|
|
141
|
+
svgIcon: A,
|
|
142
142
|
"aria-hidden": "true",
|
|
143
143
|
onClick: () => this.outputRating(o, "positive")
|
|
144
144
|
}, null), r && t(i, {
|
|
@@ -148,7 +148,7 @@ const q = {
|
|
|
148
148
|
fillMode: "flat",
|
|
149
149
|
rounded: "medium",
|
|
150
150
|
title: "Rate down",
|
|
151
|
-
svgIcon:
|
|
151
|
+
svgIcon: O,
|
|
152
152
|
"aria-hidden": "true",
|
|
153
153
|
onClick: () => this.outputRating(o, "negative")
|
|
154
154
|
}, null)]
|
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
13
13
|
*-------------------------------------------------------------------------------------------
|
|
14
14
|
*/
|
|
15
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue"),require("@progress/kendo-vue-common"),require("@progress/kendo-vue-buttons"),require("@progress/kendo-vue-inputs"),require("@progress/kendo-svg-icons"),require("@progress/kendo-vue-layout"),require("@progress/kendo-vue-intl")):"function"==typeof define&&define.amd?define(["exports","vue","@progress/kendo-vue-common","@progress/kendo-vue-buttons","@progress/kendo-vue-inputs","@progress/kendo-svg-icons","@progress/kendo-vue-layout","@progress/kendo-vue-intl"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoVueConversationalUi={},e.Vue,e.KendoVueCommon,e.KendoVueButtons,e.KendoVueInputs,e.KendoSVGIcons,e.KendoVueLayout,e.KendoVueIntl)}(this,(function(e,t,o,n,r,i,a,s){"use strict";function l(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const d=t.defineComponent({name:"KendoAIPromptHeader",props:{activeView:String,toolbarItems:Array,onActiveviewchange:Function},methods:{handleClick(e){this.$emit("activeviewchange",e)}},render(){let e;const{activeView:r,toolbarItems:i}=this.$props;return t.createVNode("div",{class:"k-prompt-header"},[t.createVNode(n.Toolbar,{overflow:"none",keyboardNavigation:!1,class:"k-toolbar-flat"},l(e=i.map((function(e){const i=o.getTemplate.call(this,{h:t.h,template:e.content,defaultRendering:null,additionalProps:{item:e}});return e.content?i:t.createVNode(n.Button,{type:"button",key:e.name,class:o.classNames("k-toolbar-item",{"k-selected":r===e.name}),size:"medium",themeColor:"primary",fillMode:"flat",rounded:"full",title:e.buttonText,svgIcon:e.buttonIcon,"aria-hidden":"true",onClick:()=>this.handleClick(e.name)},{default:()=>[e.buttonText]})}),this))?e:{default:()=>[e]})])}}),u=t.defineComponent({name:"KendoAIPromptContent",render(){const e=o.getDefaultSlots(this);return t.createVNode("div",{class:"k-prompt-content"},[t.createVNode("div",{class:"k-prompt-view"},[e])])}}),p=t.defineComponent({name:"KendoAIPromptFooter",render(){const e=o.getDefaultSlots(this);return t.createVNode("div",{class:"k-prompt-footer"},[t.createVNode("div",{class:"k-actions k-actions-start k-actions-horizontal k-prompt-actions"},[e])])}}),c=t.defineComponent({name:"KendoAIPromptViewRender",inheritAttrs:!1,props:{name:String},inject:{kendoAIPrompt:{default:null}},render(){const e=o.getDefaultSlots(this);return this.kendoAIPrompt.activeView===this.$props.name?e:null}});function m(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const h=t.defineComponent({name:"KendoAIPromptExpander",props:{title:String},data:()=>({expanded:!0}),methods:{buttonClick(){this.expanded=!this.expanded}},render(){const e=o.getDefaultSlots(this),{title:r}=this.$props;return t.createVNode("div",{class:"k-prompt-expander"},[t.createVNode(n.Button,{type:"button",fillMode:"flat",svgIcon:this.expanded?i.chevronUpIcon:i.chevronDownIcon,title:r,onClick:this.buttonClick},m(r)?r:{default:()=>[r]}),this.expanded&&t.createVNode("div",{class:"k-prompt-expander-content"},[e])])}});function g(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const f={name:"prompt-view",buttonText:"Ask AI",buttonIcon:i.sparklesIcon},v=t.defineComponent({name:"KendoAIPromptView",props:{promptInput:[Object,String],generateButton:[Object,String],promptValue:String,promptSuggestions:Array},inject:{kendoAIPrompt:{default:null}},computed:{computedValue(){return void 0!==this.$props.promptValue?this.$props.promptValue:this.value}},data:()=>({value:""}),methods:{handleOnRequest(){this.kendoAIPrompt.onPromptRequest&&this.kendoAIPrompt.onPromptRequest.call(null,this.value),this.value=""},handleSuggestionSelect(e){this.value=e},onTextChange(e){this.value=e.value}},render(){let e;const a="Generate",{promptSuggestions:s}=this.$props,l=o.templateRendering.call(this,this.$props.promptInput,o.getListeners.call(this)),d=t.createVNode(r.TextArea,{value:this.computedValue,onChange:this.onTextChange,placeholder:"Ask or generate content with AI ...",rows:2},null),m=o.getTemplate.call(this,{h:t.h,template:l,defaultRendering:d}),v=o.templateRendering.call(this,this.$props.generateButton,o.getListeners.call(this)),V=t.createVNode(n.Button,{type:"button",themeColor:"primary",fillMode:"solid","aria-hidden":"true",rounded:"full",size:"medium",onClick:this.handleOnRequest,title:"Generate",svgIcon:i.sparklesIcon},g(a)?a:{default:()=>[a]}),I=o.getTemplate.call(this,{h:t.h,template:v,defaultRendering:V});return t.createVNode(c,{name:f.name},{default:()=>[t.createVNode(u,null,{default:()=>[m,s&&s.length>0&&t.createVNode(h,{title:"Prompt Suggestions"},g(e=s.map((function(e){return t.createVNode("div",{key:e,class:"k-prompt-suggestion",onClick:()=>this.handleSuggestionSelect(e)},[e])}),this))?e:{default:()=>[e]})]}),t.createVNode(p,null,g(I)?I:{default:()=>[I]})]})}}),V="avatar.alt",I="messageList.ariaLabel",k="aIPrompt.noOutputs",y={[V]:"Avatar",[I]:"Message list",[k]:"No output from Ai available"};function C(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}let b=function(e){return e.positive="positive",e.negative="negative",e}({});const A={name:"output-view",buttonText:"Output",buttonIcon:i.commentIcon},P=t.defineComponent({name:"KendoAIPromptOutputView",emits:{copy:null,retry:null,rating:null},props:{outputs:Array,outputCard:[String,Function,Object],showOutputRating:Boolean},inject:{kendoAIPrompt:{default:null},kendoLocalizationService:{default:null}},data:()=>({copiedIndex:-1,copyButtonIcon:i.copyIcon}),methods:{retryPrompt(e){this.$emit("retry",e),this.kendoAIPrompt.onPromptRequest&&this.kendoAIPrompt.onPromptRequest.call(null,e.prompt,{...e,isRetry:!0})},copyToClipboard(e,t){null!=e&&e.responseContent&&navigator.clipboard.writeText(e.responseContent),this.copiedIndex=t,this.copyButtonIcon=i.checkIcon,this.$emit("copy",null==e?void 0:e.responseContent),setTimeout((()=>{this.copyButtonIcon=i.copyIcon,this.copiedIndex=-1}),1e3)},outputRating(e,t){this.$emit("rating",e,t),this.kendoAIPrompt.onPromptRequest&&this.kendoAIPrompt.onPromptRequest.call(null,e.prompt,{...e,ratingType:t,isRetry:!1})}},render(){let e;const{outputs:r,showOutputRating:l,outputCard:d}=this.$props,p=s.provideLocalizationService(this),m=o.templateRendering.call(this,d,o.getListeners.call(this));return t.createVNode(c,{name:A.name},{default:()=>[t.createVNode(u,null,{default:()=>[t.createVNode("div",{class:"k-card-list"},[r&&r.length>0?r.map((function(e,r){const s=o.getTemplate.call(this,{h:t.h,template:m,defaultRendering:null,additionalProps:{output:e}});return d?s:t.createVNode(a.Card,{key:e.id,class:e.class},{default:()=>[t.createVNode(a.CardHeader,null,{default:()=>[e.title&&t.createVNode(a.CardTitle,null,{default:()=>[e.title]}),e.subTitle&&t.createVNode(a.CardSubtitle,null,{default:()=>[e.subTitle]})]}),t.createVNode(a.CardBody,null,{default:()=>[e.responseContent]}),t.createVNode(a.CardActions,null,{default:()=>[t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"primary",fillMode:"flat",rounded:"medium",title:"Copy",svgIcon:this.copiedIndex===r?this.copyButtonIcon:i.copyIcon,"aria-hidden":"true",onClick:()=>this.copyToClipboard(e,r)},{default:()=>["Copy"]}),t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",title:"Retry",svgIcon:i.rotateIcon,"aria-hidden":"true",onClick:()=>this.retryPrompt(e,r)},{default:()=>["Retry"]}),l&&t.createVNode("span",{class:"k-spacer"},null),l&&t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"positive"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate up",svgIcon:i.thumbUpOutlineIcon,"aria-hidden":"true",onClick:()=>this.outputRating(e,"positive")},null),l&&t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"negative"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate down",svgIcon:i.thumbDownOutlineIcon,"aria-hidden":"true",onClick:()=>this.outputRating(e,"negative")},null)]})]})}),this):t.createVNode(a.Card,null,{default:()=>[t.createVNode(a.CardBody,null,C(e=p.toLanguageString(k,y[k]))?e:{default:()=>[e]})]})])]})]})}}),w=t.defineComponent({name:"KendoAIPrompt",props:{activeView:{type:String,required:!0},dir:String,toolbarItems:Array,outputs:Array,promptPlaceholder:String},provide(){return{kendoAIPrompt:this.$data.contextState}},data(){return{contextState:{activeView:this.$props.activeView,onActiveViewChange:this.onActiveViewChange,onPromptRequest:this.onPromptRequest,onCommandExecute:this.onCommandExecute,onStateAction:this.onStateAction}}},watch:{activeView(e){this.contextState.activeView=e}},methods:{onStateAction(e){this.contextState.activeView=e.activeView},onActiveViewChange(e){this.$emit("activeviewchange",e)},onPromptRequest(e,t){this.$emit("promptrequest",e,t)},onCommandExecute(e){this.$emit("commandexecute",e)}},render(){const e=o.getDefaultSlots(this),{toolbarItems:n,dir:r}=this.$props,i=(n||[f,A]).map((e=>{const t=o.templateRendering.call(this,e.content,o.getListeners.call(this));return{...e,content:t}}));return t.createVNode("div",{class:"k-prompt",dir:r},[t.createVNode(d,{activeView:this.contextState.activeView,toolbarItems:i,onActiveviewchange:this.onActiveViewChange},null),e])}}),N={name:"commands-view",buttonIcon:i.moreHorizontalIcon},S=t.defineComponent({name:"KendoAIPromptCommandsView",props:{commands:Array},inject:{kendoAIPrompt:{default:null}},render(){const{commands:e}=this.$props,o=e=>{var t;const o=e.target;(null==(t=o.items)||!t.length)&&this.kendoAIPrompt.onCommandExecute&&(this.$emit("commandexecute",o),this.kendoAIPrompt.onCommandExecute.call(null,o))};return t.createVNode(c,{name:N.name},{default:()=>[t.createVNode(u,null,{default:()=>[t.createVNode("div",{class:"k-prompt-view"},[t.createVNode(a.PanelBar,{onSelect:o,items:e},null)])]})]})}});e.AIPrompt=w,e.AIPromptCommandsView=S,e.AIPromptContent=u,e.AIPromptFooter=p,e.AIPromptHeader=d,e.AIPromptOutputRating=b,e.AIPromptOutputView=P,e.AIPromptView=v,e.AIPromptViewRender=c,e.commandsViewDefaults=N,e.outputViewDefaults=A,e.promptViewDefaults=f}));
|
|
15
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue"),require("@progress/kendo-vue-common"),require("@progress/kendo-vue-buttons"),require("@progress/kendo-vue-inputs"),require("@progress/kendo-svg-icons"),require("@progress/kendo-vue-layout"),require("@progress/kendo-vue-intl"),require("@progress/kendo-webspeech-common")):"function"==typeof define&&define.amd?define(["exports","vue","@progress/kendo-vue-common","@progress/kendo-vue-buttons","@progress/kendo-vue-inputs","@progress/kendo-svg-icons","@progress/kendo-vue-layout","@progress/kendo-vue-intl","@progress/kendo-webspeech-common"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoVueConversationalUi={},e.Vue,e.KendoVueCommon,e.KendoVueButtons,e.KendoVueInputs,e.KendoSVGIcons,e.KendoVueLayout,e.KendoVueIntl,e.KendoWebspeechCommon)}(this,(function(e,t,o,n,i,r,a,l,s){"use strict";function u(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const d=t.defineComponent({name:"KendoAIPromptHeader",props:{activeView:String,toolbarItems:Array,onActiveviewchange:Function},methods:{handleClick(e){this.$emit("activeviewchange",e)}},render(){let e;const{activeView:i,toolbarItems:r}=this.$props;return t.createVNode("div",{class:"k-prompt-header"},[t.createVNode(n.Toolbar,{overflow:"none",keyboardNavigation:!1,class:"k-toolbar-flat"},u(e=r.map((function(e){const r=o.getTemplate.call(this,{h:t.h,template:e.content,defaultRendering:null,additionalProps:{item:e}});return e.content?r:t.createVNode(n.Button,{type:"button",key:e.name,class:o.classNames("k-toolbar-item",{"k-selected":i===e.name}),size:"medium",themeColor:"primary",fillMode:"flat",rounded:"full",title:e.buttonText,svgIcon:e.buttonIcon,"aria-hidden":"true",onClick:()=>this.handleClick(e.name)},{default:()=>[e.buttonText]})}),this))?e:{default:()=>[e]})])}}),c=t.defineComponent({name:"KendoAIPromptContent",render(){const e=o.getDefaultSlots(this);return t.createVNode("div",{class:"k-prompt-content"},[t.createVNode("div",{class:"k-prompt-view"},[e])])}}),p=t.defineComponent({name:"KendoAIPromptFooter",render(){const e=o.getDefaultSlots(this);return t.createVNode("div",{class:"k-prompt-footer"},[t.createVNode("div",{class:"k-actions k-actions-start k-actions-horizontal k-prompt-actions"},[e])])}}),m=t.defineComponent({name:"KendoAIPromptViewRender",inheritAttrs:!1,props:{name:String},inject:{kendoAIPrompt:{default:null}},render(){const e=o.getDefaultSlots(this);return this.kendoAIPrompt.activeView===this.$props.name?e:null}});function h(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const g=t.defineComponent({name:"KendoAIPromptExpander",props:{title:String},data:()=>({expanded:!0}),methods:{buttonClick(){this.expanded=!this.expanded}},render(){const e=o.getDefaultSlots(this),{title:i}=this.$props;return t.createVNode("div",{class:"k-prompt-expander"},[t.createVNode(n.Button,{type:"button",fillMode:"flat",svgIcon:this.expanded?r.chevronUpIcon:r.chevronDownIcon,title:i,onClick:this.buttonClick},h(i)?i:{default:()=>[i]}),this.expanded&&t.createVNode("div",{class:"k-prompt-expander-content"},[e])])}});function v(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const f={name:"prompt-view",buttonText:"Ask AI",buttonIcon:r.sparklesIcon},y=t.defineComponent({name:"KendoAIPromptView",props:{promptInput:[Object,String],generateButton:[Object,String],promptValue:String,promptSuggestions:Array},inject:{kendoAIPrompt:{default:null}},computed:{computedValue(){return void 0!==this.$props.promptValue?this.$props.promptValue:this.value}},data:()=>({value:""}),methods:{handleOnRequest(){this.kendoAIPrompt.onPromptRequest&&this.kendoAIPrompt.onPromptRequest.call(null,this.value),this.value=""},handleSuggestionSelect(e){this.value=e},onTextChange(e){this.value=e.value}},render(){let e;const a="Generate",{promptSuggestions:l}=this.$props,s=o.templateRendering.call(this,this.$props.promptInput,o.getListeners.call(this)),u=t.createVNode(i.TextArea,{value:this.computedValue,onChange:this.onTextChange,placeholder:"Ask or generate content with AI ...",rows:2},null),d=o.getTemplate.call(this,{h:t.h,template:s,defaultRendering:u}),h=o.templateRendering.call(this,this.$props.generateButton,o.getListeners.call(this)),y=t.createVNode(n.Button,{type:"button",themeColor:"primary",fillMode:"solid","aria-hidden":"true",rounded:"full",size:"medium",onClick:this.handleOnRequest,title:"Generate",svgIcon:r.sparklesIcon},v(a)?a:{default:()=>[a]}),I=o.getTemplate.call(this,{h:t.h,template:h,defaultRendering:y});return t.createVNode(m,{name:f.name},{default:()=>[t.createVNode(c,null,{default:()=>[d,l&&l.length>0&&t.createVNode(g,{title:"Prompt Suggestions"},v(e=l.map((function(e){return t.createVNode("div",{key:e,class:"k-prompt-suggestion",onClick:()=>this.handleSuggestionSelect(e)},[e])}),this))?e:{default:()=>[e]})]}),t.createVNode(p,null,v(I)?I:{default:()=>[I]})]})}}),I="avatar.alt",V="messageList.ariaLabel",b="aIPrompt.noOutputs",k={[I]:"Avatar",[V]:"Message list",[b]:"No output from Ai available"};function S(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}let A=function(e){return e.positive="positive",e.negative="negative",e}({});const C={name:"output-view",buttonText:"Output",buttonIcon:r.commentIcon},w=t.defineComponent({name:"KendoAIPromptOutputView",emits:{copy:null,retry:null,rating:null},props:{outputs:Array,outputCard:[String,Function,Object],showOutputRating:Boolean},inject:{kendoAIPrompt:{default:null},kendoLocalizationService:{default:null}},data:()=>({copiedIndex:-1,copyButtonIcon:r.copyIcon}),methods:{retryPrompt(e){this.$emit("retry",e),this.kendoAIPrompt.onPromptRequest&&this.kendoAIPrompt.onPromptRequest.call(null,e.prompt,{...e,isRetry:!0})},copyToClipboard(e,t){null!=e&&e.responseContent&&navigator.clipboard.writeText(e.responseContent),this.copiedIndex=t,this.copyButtonIcon=r.checkIcon,this.$emit("copy",null==e?void 0:e.responseContent),setTimeout((()=>{this.copyButtonIcon=r.copyIcon,this.copiedIndex=-1}),1e3)},outputRating(e,t){this.$emit("rating",e,t),this.kendoAIPrompt.onPromptRequest&&this.kendoAIPrompt.onPromptRequest.call(null,e.prompt,{...e,ratingType:t,isRetry:!1})}},render(){let e;const{outputs:i,showOutputRating:s,outputCard:u}=this.$props,d=l.provideLocalizationService(this),p=o.templateRendering.call(this,u,o.getListeners.call(this));return t.createVNode(m,{name:C.name},{default:()=>[t.createVNode(c,null,{default:()=>[t.createVNode("div",{class:"k-card-list"},[i&&i.length>0?i.map((function(e,i){const l=o.getTemplate.call(this,{h:t.h,template:p,defaultRendering:null,additionalProps:{output:e}});return u?l:t.createVNode(a.Card,{key:e.id,class:e.class},{default:()=>[t.createVNode(a.CardHeader,null,{default:()=>[e.title&&t.createVNode(a.CardTitle,null,{default:()=>[e.title]}),e.subTitle&&t.createVNode(a.CardSubtitle,null,{default:()=>[e.subTitle]})]}),t.createVNode(a.CardBody,null,{default:()=>[e.responseContent]}),t.createVNode(a.CardActions,null,{default:()=>[t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"primary",fillMode:"flat",rounded:"medium",title:"Copy",svgIcon:this.copiedIndex===i?this.copyButtonIcon:r.copyIcon,"aria-hidden":"true",onClick:()=>this.copyToClipboard(e,i)},{default:()=>["Copy"]}),t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",title:"Retry",svgIcon:r.rotateIcon,"aria-hidden":"true",onClick:()=>this.retryPrompt(e,i)},{default:()=>["Retry"]}),s&&t.createVNode("span",{class:"k-spacer"},null),s&&t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"positive"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate up",svgIcon:r.thumbUpOutlineIcon,"aria-hidden":"true",onClick:()=>this.outputRating(e,"positive")},null),s&&t.createVNode(n.Button,{type:"button",size:"medium",themeColor:"negative"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate down",svgIcon:r.thumbDownOutlineIcon,"aria-hidden":"true",onClick:()=>this.outputRating(e,"negative")},null)]})]})}),this):t.createVNode(a.Card,null,{default:()=>[t.createVNode(a.CardBody,null,S(e=d.toLanguageString(b,k[b]))?e:{default:()=>[e]})]})])]})]})}}),N=t.defineComponent({name:"KendoAIPrompt",props:{activeView:{type:String,required:!0},dir:String,toolbarItems:Array,outputs:Array,promptPlaceholder:String},provide(){return{kendoAIPrompt:this.$data.contextState}},data(){return{contextState:{activeView:this.$props.activeView,onActiveViewChange:this.onActiveViewChange,onPromptRequest:this.onPromptRequest,onCommandExecute:this.onCommandExecute,onStateAction:this.onStateAction}}},watch:{activeView(e){this.contextState.activeView=e}},methods:{onStateAction(e){this.contextState.activeView=e.activeView},onActiveViewChange(e){this.$emit("activeviewchange",e)},onPromptRequest(e,t){this.$emit("promptrequest",e,t)},onCommandExecute(e){this.$emit("commandexecute",e)}},render(){const e=o.getDefaultSlots(this),{toolbarItems:n,dir:i}=this.$props,r=(n||[f,C]).map((e=>{const t=o.templateRendering.call(this,e.content,o.getListeners.call(this));return{...e,content:t}}));return t.createVNode("div",{class:"k-prompt",dir:i},[t.createVNode(d,{activeView:this.contextState.activeView,toolbarItems:r,onActiveviewchange:this.onActiveViewChange},null),e])}}),P={name:"commands-view",buttonIcon:r.moreHorizontalIcon},x=t.defineComponent({name:"KendoAIPromptCommandsView",props:{commands:Array},inject:{kendoAIPrompt:{default:null}},render(){const{commands:e}=this.$props,o=e=>{var t;const o=e.target;(null==(t=o.items)||!t.length)&&this.kendoAIPrompt.onCommandExecute&&(this.$emit("commandexecute",o),this.kendoAIPrompt.onCommandExecute.call(null,o))};return t.createVNode(m,{name:P.name},{default:()=>[t.createVNode(c,null,{default:()=>[t.createVNode("div",{class:"k-prompt-view"},[t.createVNode(a.PanelBar,{onSelect:o,items:e},null)])]})]})}});let R=function(e){return e.WebSpeech="WebSpeech",e.None="None",e}({});const T=t.defineComponent({name:"KendoSpeechToTextButton",props:{lang:{type:String,default:"en-US"},continuous:{type:Boolean,default:!1},interimResults:{type:Boolean,default:!1},maxAlternatives:{type:Number,default:1},integrationMode:{type:String,default:R.WebSpeech},onStart:{type:Function},onResult:{type:Function},onEnd:{type:Function},onError:{type:Function},svgIcon:{type:Object,default:r.microphoneOutlineIcon},iconSize:{type:String,default:"medium"},disabled:{type:Boolean,default:void 0},size:{type:String,default:"medium"},rounded:{type:String,default:"medium"},fillMode:{type:String,default:"solid"},themeColor:{type:String,default:"base"},title:{type:String,default:"Speech to Text Button"},ariaLabel:{type:String,default:"Start speech recognition"}},setup(e,{emit:o,expose:n}){const i=t.ref(null),r=t.ref(!1),a=()=>e.integrationMode!==R.None,l=()=>{var e;r.value||(a&&(null==(e=i.value)||e.start()),r.value=!0)},u=()=>{var e;r.value&&(a&&(null==(e=i.value)||e.stop()),r.value=!1)},d=async()=>{r.value||e.onStart&&(await e.onStart(),l())},c=e=>{const t=e.results,n=t[t.length-1],i=Array.from(n).map((e=>({transcript:e.transcript,confidence:e.confidence})));o("result",{isFinal:n.isFinal,alternatives:i})},p=async()=>{r.value&&e.onEnd&&(await e.onEnd(),u())},m=e=>{o("error",e)},h=()=>{var t;e.integrationMode===R.WebSpeech&&(null!=(t=i.value)&&t.isActive()&&u(),i.value=function(e){return new s.KendoSpeechRecognition(e)}({lang:e.lang,continuous:e.continuous,interimResults:e.interimResults,integrationMode:e.integrationMode,maxAlternatives:e.maxAlternatives,events:{start:d,result:c,end:p,error:m}}))};return t.watch((()=>({lang:e.lang,continuous:e.continuous,interimResults:e.interimResults,integrationMode:e.integrationMode,maxAlternatives:e.maxAlternatives})),(()=>{h()}),{deep:!0}),t.onMounted((()=>{h()})),t.onUnmounted((()=>{var e;null!=(e=i.value)&&e.isInActiveState&&u()})),n({start:l,stop:u,isActive:()=>{var e;return null==(e=i.value)?void 0:e.isActive()}}),{clickHandler:()=>{r.value?p():d()},isInActiveState:r}},render(){const{ariaLabel:e,svgIcon:o,fillMode:i,rounded:a,size:l,disabled:s,themeColor:u,iconSize:d,title:c}=this.$props,{className:p,style:m,id:h}=this.$attrs,g=t.computed((()=>["k-speech-to-text-button",p,{"k-listening":this.isInActiveState}])),v=t.computed((()=>this.isInActiveState?r.stopSmIcon:o||r.microphoneOutlineIcon));return t.createVNode(n.Button,{id:h,style:m,class:g.value,onClick:this.clickHandler,svgIcon:v.value,iconSize:d,fillMode:i,rounded:a,size:l,themeColor:u,"aria-label":e,disabled:s,title:c},null)}});e.AIPrompt=N,e.AIPromptCommandsView=x,e.AIPromptContent=c,e.AIPromptFooter=p,e.AIPromptHeader=d,e.AIPromptOutputRating=A,e.AIPromptOutputView=w,e.AIPromptView=y,e.AIPromptViewRender=m,e.SpeechToTextButton=T,e.SpeechToTextButtonMode=R,e.commandsViewDefaults=P,e.outputViewDefaults=C,e.promptViewDefaults=f}));
|
package/index.d.mts
CHANGED
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
+
import { ButtonProps } from '@progress/kendo-vue-buttons';
|
|
8
9
|
import { ComponentOptionsMixin } from 'vue';
|
|
9
10
|
import { ComponentProvideOptions } from 'vue';
|
|
10
11
|
import { DefineComponent } from 'vue';
|
|
11
12
|
import { ExtractPropTypes } from 'vue';
|
|
12
13
|
import { PropType } from 'vue';
|
|
13
14
|
import { PublicProps } from 'vue';
|
|
15
|
+
import { Ref } from 'vue';
|
|
14
16
|
import { SVGIcon } from '@progress/kendo-svg-icons';
|
|
15
17
|
import { SVGIcon as SVGIcon_2 } from '@progress/kendo-vue-common';
|
|
16
18
|
|
|
@@ -368,6 +370,270 @@ export declare const outputViewDefaults: AIPromptToolbarItemInterface;
|
|
|
368
370
|
*/
|
|
369
371
|
export declare const promptViewDefaults: AIPromptToolbarItemInterface;
|
|
370
372
|
|
|
373
|
+
/**
|
|
374
|
+
* Represents a single recognition alternative from the speech engine.
|
|
375
|
+
*/
|
|
376
|
+
declare interface SpeechRecognitionAlternative_2 {
|
|
377
|
+
/**
|
|
378
|
+
* The transcript of the recognized speech.
|
|
379
|
+
*/
|
|
380
|
+
transcript: string;
|
|
381
|
+
/**
|
|
382
|
+
* A confidence score for the transcript, between 0 and 1.
|
|
383
|
+
*/
|
|
384
|
+
confidence: number;
|
|
385
|
+
}
|
|
386
|
+
export { SpeechRecognitionAlternative_2 as SpeechRecognitionAlternative }
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* @hidden
|
|
390
|
+
*/
|
|
391
|
+
export declare const SpeechToTextButton: DefineComponent<ExtractPropTypes< {
|
|
392
|
+
lang: {
|
|
393
|
+
type: PropType<string>;
|
|
394
|
+
default: string;
|
|
395
|
+
};
|
|
396
|
+
continuous: {
|
|
397
|
+
type: PropType<boolean>;
|
|
398
|
+
default: boolean;
|
|
399
|
+
};
|
|
400
|
+
interimResults: {
|
|
401
|
+
type: PropType<boolean>;
|
|
402
|
+
default: boolean;
|
|
403
|
+
};
|
|
404
|
+
maxAlternatives: {
|
|
405
|
+
type: PropType<number>;
|
|
406
|
+
default: number;
|
|
407
|
+
};
|
|
408
|
+
integrationMode: {
|
|
409
|
+
type: PropType<"WebSpeech" | "None">;
|
|
410
|
+
default: SpeechToTextButtonMode;
|
|
411
|
+
};
|
|
412
|
+
onStart: {
|
|
413
|
+
type: PropType<() => void>;
|
|
414
|
+
};
|
|
415
|
+
onResult: {
|
|
416
|
+
type: PropType<(event: SpeechToTextResultEvent) => void>;
|
|
417
|
+
};
|
|
418
|
+
onEnd: {
|
|
419
|
+
type: PropType<() => void>;
|
|
420
|
+
};
|
|
421
|
+
onError: {
|
|
422
|
+
type: PropType<(event: SpeechToTextErrorEvent) => void>;
|
|
423
|
+
};
|
|
424
|
+
svgIcon: {
|
|
425
|
+
type: PropType<SVGIcon_2>;
|
|
426
|
+
default: SVGIcon;
|
|
427
|
+
};
|
|
428
|
+
iconSize: {
|
|
429
|
+
type: PropType<string>;
|
|
430
|
+
default: string;
|
|
431
|
+
};
|
|
432
|
+
disabled: {
|
|
433
|
+
type: PropType<boolean>;
|
|
434
|
+
default: any;
|
|
435
|
+
};
|
|
436
|
+
size: {
|
|
437
|
+
type: PropType<string>;
|
|
438
|
+
default: string;
|
|
439
|
+
};
|
|
440
|
+
rounded: {
|
|
441
|
+
type: PropType<string>;
|
|
442
|
+
default: string;
|
|
443
|
+
};
|
|
444
|
+
fillMode: {
|
|
445
|
+
type: PropType<string>;
|
|
446
|
+
default: string;
|
|
447
|
+
};
|
|
448
|
+
themeColor: {
|
|
449
|
+
type: PropType<string>;
|
|
450
|
+
default: string;
|
|
451
|
+
};
|
|
452
|
+
title: {
|
|
453
|
+
type: PropType<string>;
|
|
454
|
+
default: string;
|
|
455
|
+
};
|
|
456
|
+
ariaLabel: {
|
|
457
|
+
type: PropType<string>;
|
|
458
|
+
default: string;
|
|
459
|
+
};
|
|
460
|
+
}>, {
|
|
461
|
+
clickHandler: () => void;
|
|
462
|
+
isInActiveState: Ref<boolean, boolean>;
|
|
463
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< {
|
|
464
|
+
lang: {
|
|
465
|
+
type: PropType<string>;
|
|
466
|
+
default: string;
|
|
467
|
+
};
|
|
468
|
+
continuous: {
|
|
469
|
+
type: PropType<boolean>;
|
|
470
|
+
default: boolean;
|
|
471
|
+
};
|
|
472
|
+
interimResults: {
|
|
473
|
+
type: PropType<boolean>;
|
|
474
|
+
default: boolean;
|
|
475
|
+
};
|
|
476
|
+
maxAlternatives: {
|
|
477
|
+
type: PropType<number>;
|
|
478
|
+
default: number;
|
|
479
|
+
};
|
|
480
|
+
integrationMode: {
|
|
481
|
+
type: PropType<"WebSpeech" | "None">;
|
|
482
|
+
default: SpeechToTextButtonMode;
|
|
483
|
+
};
|
|
484
|
+
onStart: {
|
|
485
|
+
type: PropType<() => void>;
|
|
486
|
+
};
|
|
487
|
+
onResult: {
|
|
488
|
+
type: PropType<(event: SpeechToTextResultEvent) => void>;
|
|
489
|
+
};
|
|
490
|
+
onEnd: {
|
|
491
|
+
type: PropType<() => void>;
|
|
492
|
+
};
|
|
493
|
+
onError: {
|
|
494
|
+
type: PropType<(event: SpeechToTextErrorEvent) => void>;
|
|
495
|
+
};
|
|
496
|
+
svgIcon: {
|
|
497
|
+
type: PropType<SVGIcon_2>;
|
|
498
|
+
default: SVGIcon;
|
|
499
|
+
};
|
|
500
|
+
iconSize: {
|
|
501
|
+
type: PropType<string>;
|
|
502
|
+
default: string;
|
|
503
|
+
};
|
|
504
|
+
disabled: {
|
|
505
|
+
type: PropType<boolean>;
|
|
506
|
+
default: any;
|
|
507
|
+
};
|
|
508
|
+
size: {
|
|
509
|
+
type: PropType<string>;
|
|
510
|
+
default: string;
|
|
511
|
+
};
|
|
512
|
+
rounded: {
|
|
513
|
+
type: PropType<string>;
|
|
514
|
+
default: string;
|
|
515
|
+
};
|
|
516
|
+
fillMode: {
|
|
517
|
+
type: PropType<string>;
|
|
518
|
+
default: string;
|
|
519
|
+
};
|
|
520
|
+
themeColor: {
|
|
521
|
+
type: PropType<string>;
|
|
522
|
+
default: string;
|
|
523
|
+
};
|
|
524
|
+
title: {
|
|
525
|
+
type: PropType<string>;
|
|
526
|
+
default: string;
|
|
527
|
+
};
|
|
528
|
+
ariaLabel: {
|
|
529
|
+
type: PropType<string>;
|
|
530
|
+
default: string;
|
|
531
|
+
};
|
|
532
|
+
}>> & Readonly<{}>, {
|
|
533
|
+
title: string;
|
|
534
|
+
ariaLabel: string;
|
|
535
|
+
themeColor: string;
|
|
536
|
+
size: string;
|
|
537
|
+
rounded: string;
|
|
538
|
+
fillMode: string;
|
|
539
|
+
iconSize: string;
|
|
540
|
+
svgIcon: SVGIcon_2;
|
|
541
|
+
disabled: boolean;
|
|
542
|
+
lang: string;
|
|
543
|
+
continuous: boolean;
|
|
544
|
+
interimResults: boolean;
|
|
545
|
+
maxAlternatives: number;
|
|
546
|
+
integrationMode: "WebSpeech" | "None";
|
|
547
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
548
|
+
|
|
549
|
+
export declare enum SpeechToTextButtonMode {
|
|
550
|
+
WebSpeech = "WebSpeech",
|
|
551
|
+
None = "None"
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
export declare interface SpeechToTextButtonProps extends Omit<ButtonProps, 'shape'> {
|
|
555
|
+
/**
|
|
556
|
+
* The language to use for speech recognition. Defaults to 'en-US'.
|
|
557
|
+
*/
|
|
558
|
+
lang?: string;
|
|
559
|
+
/**
|
|
560
|
+
* Specifies whether the speech recognition should continue until explicitly stopped. Defaults to `true`.
|
|
561
|
+
*/
|
|
562
|
+
continuous?: boolean;
|
|
563
|
+
/**
|
|
564
|
+
* Specifies whether to return interim results. Defaults to `true`.
|
|
565
|
+
*/
|
|
566
|
+
interimResults?: boolean;
|
|
567
|
+
/**
|
|
568
|
+
* Specifies the maximum number of alternative transcriptions to return. Defaults to `1`.
|
|
569
|
+
*/
|
|
570
|
+
maxAlternatives?: number;
|
|
571
|
+
/**
|
|
572
|
+
* Specifies which speech recognition engine or integration the component should use.
|
|
573
|
+
* This allows the component to operate in different environments or use alternative implementations.
|
|
574
|
+
*/
|
|
575
|
+
integrationMode?: 'WebSpeech' | 'None';
|
|
576
|
+
/**
|
|
577
|
+
* Callback function that is called when speech recognition starts.
|
|
578
|
+
*/
|
|
579
|
+
onStart?: () => void;
|
|
580
|
+
/**
|
|
581
|
+
* Callback function that is called when a speech recognition result is available.
|
|
582
|
+
* The event contains the `isFinal` flag and an array of alternatives.
|
|
583
|
+
*/
|
|
584
|
+
onResult?: (event: SpeechToTextResultEvent) => void;
|
|
585
|
+
/**
|
|
586
|
+
* Callback function that is called when speech recognition ends.
|
|
587
|
+
*/
|
|
588
|
+
onEnd?: () => void;
|
|
589
|
+
/**
|
|
590
|
+
* Callback function that is called when an error occurs during speech recognition.
|
|
591
|
+
*/
|
|
592
|
+
onError?: (event: SpeechToTextErrorEvent) => void;
|
|
593
|
+
/**
|
|
594
|
+
* Method that helps you start the speech recognition process manually.
|
|
595
|
+
*
|
|
596
|
+
* @memberof SpeechToTextButtonProps
|
|
597
|
+
*/
|
|
598
|
+
start(): void;
|
|
599
|
+
/**
|
|
600
|
+
* Method that helps you stop the speech recognition process manually.
|
|
601
|
+
*
|
|
602
|
+
* @memberof SpeechToTextButtonProps
|
|
603
|
+
*/
|
|
604
|
+
stop(): void;
|
|
605
|
+
/**
|
|
606
|
+
* Method that checks if the speech recognition is currently active.
|
|
607
|
+
*
|
|
608
|
+
* @returns `true` if the speech recognition is active, otherwise `false`.
|
|
609
|
+
*/
|
|
610
|
+
isActive(): boolean;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* The event argument for the `error` event of the SpeechToTextButton.
|
|
615
|
+
*/
|
|
616
|
+
export declare interface SpeechToTextErrorEvent {
|
|
617
|
+
/**
|
|
618
|
+
* Message detailing the cause of the speech recognition error. Use this message for debugging or user feedback.
|
|
619
|
+
*/
|
|
620
|
+
errorMessage: string;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* The event argument for the `result` event of the SpeechToTextButton.
|
|
625
|
+
*/
|
|
626
|
+
export declare interface SpeechToTextResultEvent {
|
|
627
|
+
/**
|
|
628
|
+
* Indicates whether the speech recognition result is final (true) or interim (false).
|
|
629
|
+
*/
|
|
630
|
+
isFinal: boolean;
|
|
631
|
+
/**
|
|
632
|
+
* An array of possible recognition alternatives returned by the speech engine.
|
|
633
|
+
*/
|
|
634
|
+
alternatives: SpeechRecognitionAlternative_2[];
|
|
635
|
+
}
|
|
636
|
+
|
|
371
637
|
/**
|
|
372
638
|
* @hidden
|
|
373
639
|
*/
|
package/index.d.ts
CHANGED
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
+
import { ButtonProps } from '@progress/kendo-vue-buttons';
|
|
8
9
|
import { ComponentOptionsMixin } from 'vue';
|
|
9
10
|
import { ComponentProvideOptions } from 'vue';
|
|
10
11
|
import { DefineComponent } from 'vue';
|
|
11
12
|
import { ExtractPropTypes } from 'vue';
|
|
12
13
|
import { PropType } from 'vue';
|
|
13
14
|
import { PublicProps } from 'vue';
|
|
15
|
+
import { Ref } from 'vue';
|
|
14
16
|
import { SVGIcon } from '@progress/kendo-svg-icons';
|
|
15
17
|
import { SVGIcon as SVGIcon_2 } from '@progress/kendo-vue-common';
|
|
16
18
|
|
|
@@ -368,6 +370,270 @@ export declare const outputViewDefaults: AIPromptToolbarItemInterface;
|
|
|
368
370
|
*/
|
|
369
371
|
export declare const promptViewDefaults: AIPromptToolbarItemInterface;
|
|
370
372
|
|
|
373
|
+
/**
|
|
374
|
+
* Represents a single recognition alternative from the speech engine.
|
|
375
|
+
*/
|
|
376
|
+
declare interface SpeechRecognitionAlternative_2 {
|
|
377
|
+
/**
|
|
378
|
+
* The transcript of the recognized speech.
|
|
379
|
+
*/
|
|
380
|
+
transcript: string;
|
|
381
|
+
/**
|
|
382
|
+
* A confidence score for the transcript, between 0 and 1.
|
|
383
|
+
*/
|
|
384
|
+
confidence: number;
|
|
385
|
+
}
|
|
386
|
+
export { SpeechRecognitionAlternative_2 as SpeechRecognitionAlternative }
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* @hidden
|
|
390
|
+
*/
|
|
391
|
+
export declare const SpeechToTextButton: DefineComponent<ExtractPropTypes< {
|
|
392
|
+
lang: {
|
|
393
|
+
type: PropType<string>;
|
|
394
|
+
default: string;
|
|
395
|
+
};
|
|
396
|
+
continuous: {
|
|
397
|
+
type: PropType<boolean>;
|
|
398
|
+
default: boolean;
|
|
399
|
+
};
|
|
400
|
+
interimResults: {
|
|
401
|
+
type: PropType<boolean>;
|
|
402
|
+
default: boolean;
|
|
403
|
+
};
|
|
404
|
+
maxAlternatives: {
|
|
405
|
+
type: PropType<number>;
|
|
406
|
+
default: number;
|
|
407
|
+
};
|
|
408
|
+
integrationMode: {
|
|
409
|
+
type: PropType<"WebSpeech" | "None">;
|
|
410
|
+
default: SpeechToTextButtonMode;
|
|
411
|
+
};
|
|
412
|
+
onStart: {
|
|
413
|
+
type: PropType<() => void>;
|
|
414
|
+
};
|
|
415
|
+
onResult: {
|
|
416
|
+
type: PropType<(event: SpeechToTextResultEvent) => void>;
|
|
417
|
+
};
|
|
418
|
+
onEnd: {
|
|
419
|
+
type: PropType<() => void>;
|
|
420
|
+
};
|
|
421
|
+
onError: {
|
|
422
|
+
type: PropType<(event: SpeechToTextErrorEvent) => void>;
|
|
423
|
+
};
|
|
424
|
+
svgIcon: {
|
|
425
|
+
type: PropType<SVGIcon_2>;
|
|
426
|
+
default: SVGIcon;
|
|
427
|
+
};
|
|
428
|
+
iconSize: {
|
|
429
|
+
type: PropType<string>;
|
|
430
|
+
default: string;
|
|
431
|
+
};
|
|
432
|
+
disabled: {
|
|
433
|
+
type: PropType<boolean>;
|
|
434
|
+
default: any;
|
|
435
|
+
};
|
|
436
|
+
size: {
|
|
437
|
+
type: PropType<string>;
|
|
438
|
+
default: string;
|
|
439
|
+
};
|
|
440
|
+
rounded: {
|
|
441
|
+
type: PropType<string>;
|
|
442
|
+
default: string;
|
|
443
|
+
};
|
|
444
|
+
fillMode: {
|
|
445
|
+
type: PropType<string>;
|
|
446
|
+
default: string;
|
|
447
|
+
};
|
|
448
|
+
themeColor: {
|
|
449
|
+
type: PropType<string>;
|
|
450
|
+
default: string;
|
|
451
|
+
};
|
|
452
|
+
title: {
|
|
453
|
+
type: PropType<string>;
|
|
454
|
+
default: string;
|
|
455
|
+
};
|
|
456
|
+
ariaLabel: {
|
|
457
|
+
type: PropType<string>;
|
|
458
|
+
default: string;
|
|
459
|
+
};
|
|
460
|
+
}>, {
|
|
461
|
+
clickHandler: () => void;
|
|
462
|
+
isInActiveState: Ref<boolean, boolean>;
|
|
463
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< {
|
|
464
|
+
lang: {
|
|
465
|
+
type: PropType<string>;
|
|
466
|
+
default: string;
|
|
467
|
+
};
|
|
468
|
+
continuous: {
|
|
469
|
+
type: PropType<boolean>;
|
|
470
|
+
default: boolean;
|
|
471
|
+
};
|
|
472
|
+
interimResults: {
|
|
473
|
+
type: PropType<boolean>;
|
|
474
|
+
default: boolean;
|
|
475
|
+
};
|
|
476
|
+
maxAlternatives: {
|
|
477
|
+
type: PropType<number>;
|
|
478
|
+
default: number;
|
|
479
|
+
};
|
|
480
|
+
integrationMode: {
|
|
481
|
+
type: PropType<"WebSpeech" | "None">;
|
|
482
|
+
default: SpeechToTextButtonMode;
|
|
483
|
+
};
|
|
484
|
+
onStart: {
|
|
485
|
+
type: PropType<() => void>;
|
|
486
|
+
};
|
|
487
|
+
onResult: {
|
|
488
|
+
type: PropType<(event: SpeechToTextResultEvent) => void>;
|
|
489
|
+
};
|
|
490
|
+
onEnd: {
|
|
491
|
+
type: PropType<() => void>;
|
|
492
|
+
};
|
|
493
|
+
onError: {
|
|
494
|
+
type: PropType<(event: SpeechToTextErrorEvent) => void>;
|
|
495
|
+
};
|
|
496
|
+
svgIcon: {
|
|
497
|
+
type: PropType<SVGIcon_2>;
|
|
498
|
+
default: SVGIcon;
|
|
499
|
+
};
|
|
500
|
+
iconSize: {
|
|
501
|
+
type: PropType<string>;
|
|
502
|
+
default: string;
|
|
503
|
+
};
|
|
504
|
+
disabled: {
|
|
505
|
+
type: PropType<boolean>;
|
|
506
|
+
default: any;
|
|
507
|
+
};
|
|
508
|
+
size: {
|
|
509
|
+
type: PropType<string>;
|
|
510
|
+
default: string;
|
|
511
|
+
};
|
|
512
|
+
rounded: {
|
|
513
|
+
type: PropType<string>;
|
|
514
|
+
default: string;
|
|
515
|
+
};
|
|
516
|
+
fillMode: {
|
|
517
|
+
type: PropType<string>;
|
|
518
|
+
default: string;
|
|
519
|
+
};
|
|
520
|
+
themeColor: {
|
|
521
|
+
type: PropType<string>;
|
|
522
|
+
default: string;
|
|
523
|
+
};
|
|
524
|
+
title: {
|
|
525
|
+
type: PropType<string>;
|
|
526
|
+
default: string;
|
|
527
|
+
};
|
|
528
|
+
ariaLabel: {
|
|
529
|
+
type: PropType<string>;
|
|
530
|
+
default: string;
|
|
531
|
+
};
|
|
532
|
+
}>> & Readonly<{}>, {
|
|
533
|
+
title: string;
|
|
534
|
+
ariaLabel: string;
|
|
535
|
+
themeColor: string;
|
|
536
|
+
size: string;
|
|
537
|
+
rounded: string;
|
|
538
|
+
fillMode: string;
|
|
539
|
+
iconSize: string;
|
|
540
|
+
svgIcon: SVGIcon_2;
|
|
541
|
+
disabled: boolean;
|
|
542
|
+
lang: string;
|
|
543
|
+
continuous: boolean;
|
|
544
|
+
interimResults: boolean;
|
|
545
|
+
maxAlternatives: number;
|
|
546
|
+
integrationMode: "WebSpeech" | "None";
|
|
547
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
548
|
+
|
|
549
|
+
export declare enum SpeechToTextButtonMode {
|
|
550
|
+
WebSpeech = "WebSpeech",
|
|
551
|
+
None = "None"
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
export declare interface SpeechToTextButtonProps extends Omit<ButtonProps, 'shape'> {
|
|
555
|
+
/**
|
|
556
|
+
* The language to use for speech recognition. Defaults to 'en-US'.
|
|
557
|
+
*/
|
|
558
|
+
lang?: string;
|
|
559
|
+
/**
|
|
560
|
+
* Specifies whether the speech recognition should continue until explicitly stopped. Defaults to `true`.
|
|
561
|
+
*/
|
|
562
|
+
continuous?: boolean;
|
|
563
|
+
/**
|
|
564
|
+
* Specifies whether to return interim results. Defaults to `true`.
|
|
565
|
+
*/
|
|
566
|
+
interimResults?: boolean;
|
|
567
|
+
/**
|
|
568
|
+
* Specifies the maximum number of alternative transcriptions to return. Defaults to `1`.
|
|
569
|
+
*/
|
|
570
|
+
maxAlternatives?: number;
|
|
571
|
+
/**
|
|
572
|
+
* Specifies which speech recognition engine or integration the component should use.
|
|
573
|
+
* This allows the component to operate in different environments or use alternative implementations.
|
|
574
|
+
*/
|
|
575
|
+
integrationMode?: 'WebSpeech' | 'None';
|
|
576
|
+
/**
|
|
577
|
+
* Callback function that is called when speech recognition starts.
|
|
578
|
+
*/
|
|
579
|
+
onStart?: () => void;
|
|
580
|
+
/**
|
|
581
|
+
* Callback function that is called when a speech recognition result is available.
|
|
582
|
+
* The event contains the `isFinal` flag and an array of alternatives.
|
|
583
|
+
*/
|
|
584
|
+
onResult?: (event: SpeechToTextResultEvent) => void;
|
|
585
|
+
/**
|
|
586
|
+
* Callback function that is called when speech recognition ends.
|
|
587
|
+
*/
|
|
588
|
+
onEnd?: () => void;
|
|
589
|
+
/**
|
|
590
|
+
* Callback function that is called when an error occurs during speech recognition.
|
|
591
|
+
*/
|
|
592
|
+
onError?: (event: SpeechToTextErrorEvent) => void;
|
|
593
|
+
/**
|
|
594
|
+
* Method that helps you start the speech recognition process manually.
|
|
595
|
+
*
|
|
596
|
+
* @memberof SpeechToTextButtonProps
|
|
597
|
+
*/
|
|
598
|
+
start(): void;
|
|
599
|
+
/**
|
|
600
|
+
* Method that helps you stop the speech recognition process manually.
|
|
601
|
+
*
|
|
602
|
+
* @memberof SpeechToTextButtonProps
|
|
603
|
+
*/
|
|
604
|
+
stop(): void;
|
|
605
|
+
/**
|
|
606
|
+
* Method that checks if the speech recognition is currently active.
|
|
607
|
+
*
|
|
608
|
+
* @returns `true` if the speech recognition is active, otherwise `false`.
|
|
609
|
+
*/
|
|
610
|
+
isActive(): boolean;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* The event argument for the `error` event of the SpeechToTextButton.
|
|
615
|
+
*/
|
|
616
|
+
export declare interface SpeechToTextErrorEvent {
|
|
617
|
+
/**
|
|
618
|
+
* Message detailing the cause of the speech recognition error. Use this message for debugging or user feedback.
|
|
619
|
+
*/
|
|
620
|
+
errorMessage: string;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* The event argument for the `result` event of the SpeechToTextButton.
|
|
625
|
+
*/
|
|
626
|
+
export declare interface SpeechToTextResultEvent {
|
|
627
|
+
/**
|
|
628
|
+
* Indicates whether the speech recognition result is final (true) or interim (false).
|
|
629
|
+
*/
|
|
630
|
+
isFinal: boolean;
|
|
631
|
+
/**
|
|
632
|
+
* An array of possible recognition alternatives returned by the speech engine.
|
|
633
|
+
*/
|
|
634
|
+
alternatives: SpeechRecognitionAlternative_2[];
|
|
635
|
+
}
|
|
636
|
+
|
|
371
637
|
/**
|
|
372
638
|
* @hidden
|
|
373
639
|
*/
|
package/index.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./ai-prompt/AIPrompt.js"),m=require("./ai-prompt/AIPromptHeader.js"),u=require("./ai-prompt/AIPromptFooter.js"),i=require("./ai-prompt/AIPromptContent.js"),e=require("./ai-prompt/views/AIPromptView.js"),t=require("./ai-prompt/views/AIPromptOutputView.js"),o=require("./ai-prompt/views/AIPromptCommandsView.js"),n=require("./ai-prompt/views/AIPromptViewRender.js"),r=require("./speech-to-text/SpeechToTextButton.js");exports.AIPrompt=p.AIPrompt;exports.AIPromptHeader=m.AIPromptHeader;exports.AIPromptFooter=u.AIPromptFooter;exports.AIPromptContent=i.AIPromptContent;exports.AIPromptView=e.AIPromptView;exports.promptViewDefaults=e.promptViewDefaults;exports.AIPromptOutputRating=t.AIPromptOutputRating;exports.AIPromptOutputView=t.AIPromptOutputView;exports.outputViewDefaults=t.outputViewDefaults;exports.AIPromptCommandsView=o.AIPromptCommandsView;exports.commandsViewDefaults=o.commandsViewDefaults;exports.AIPromptViewRender=n.AIPromptViewRender;exports.SpeechToTextButton=r.SpeechToTextButton;exports.SpeechToTextButtonMode=r.SpeechToTextButtonMode;
|
package/index.mjs
CHANGED
|
@@ -5,25 +5,28 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { AIPrompt as
|
|
9
|
-
import { AIPromptHeader as
|
|
8
|
+
import { AIPrompt as e } from "./ai-prompt/AIPrompt.mjs";
|
|
9
|
+
import { AIPromptHeader as p } from "./ai-prompt/AIPromptHeader.mjs";
|
|
10
10
|
import { AIPromptFooter as f } from "./ai-prompt/AIPromptFooter.mjs";
|
|
11
|
-
import { AIPromptContent as
|
|
12
|
-
import { AIPromptView as
|
|
13
|
-
import { AIPromptOutputRating as
|
|
14
|
-
import { AIPromptCommandsView as
|
|
15
|
-
import { AIPromptViewRender as
|
|
11
|
+
import { AIPromptContent as x } from "./ai-prompt/AIPromptContent.mjs";
|
|
12
|
+
import { AIPromptView as I, promptViewDefaults as P } from "./ai-prompt/views/AIPromptView.mjs";
|
|
13
|
+
import { AIPromptOutputRating as n, AIPromptOutputView as a, outputViewDefaults as w } from "./ai-prompt/views/AIPromptOutputView.mjs";
|
|
14
|
+
import { AIPromptCommandsView as d, commandsViewDefaults as s } from "./ai-prompt/views/AIPromptCommandsView.mjs";
|
|
15
|
+
import { AIPromptViewRender as c } from "./ai-prompt/views/AIPromptViewRender.mjs";
|
|
16
|
+
import { SpeechToTextButton as D, SpeechToTextButtonMode as h } from "./speech-to-text/SpeechToTextButton.mjs";
|
|
16
17
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
e as AIPrompt,
|
|
19
|
+
d as AIPromptCommandsView,
|
|
20
|
+
x as AIPromptContent,
|
|
20
21
|
f as AIPromptFooter,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
p as AIPromptHeader,
|
|
23
|
+
n as AIPromptOutputRating,
|
|
24
|
+
a as AIPromptOutputView,
|
|
25
|
+
I as AIPromptView,
|
|
26
|
+
c as AIPromptViewRender,
|
|
27
|
+
D as SpeechToTextButton,
|
|
28
|
+
h as SpeechToTextButtonMode,
|
|
29
|
+
s as commandsViewDefaults,
|
|
30
|
+
w as outputViewDefaults,
|
|
31
|
+
P as promptViewDefaults
|
|
29
32
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-vue-conversational-ui",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0-develop.1",
|
|
4
4
|
"description": "TODO",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"@progress/kendo-licensing": "^1.4.0",
|
|
22
|
-
"@progress/kendo-vue-buttons": "6.
|
|
23
|
-
"@progress/kendo-vue-common": "6.
|
|
24
|
-
"@progress/kendo-vue-intl": "6.
|
|
25
|
-
"@progress/kendo-vue-inputs": "6.
|
|
26
|
-
"@progress/kendo-vue-layout": "6.
|
|
22
|
+
"@progress/kendo-vue-buttons": "6.5.0-develop.1",
|
|
23
|
+
"@progress/kendo-vue-common": "6.5.0-develop.1",
|
|
24
|
+
"@progress/kendo-vue-intl": "6.5.0-develop.1",
|
|
25
|
+
"@progress/kendo-vue-inputs": "6.5.0-develop.1",
|
|
26
|
+
"@progress/kendo-vue-layout": "6.5.0-develop.1",
|
|
27
27
|
"@progress/kendo-svg-icons": "^4.0.0",
|
|
28
28
|
"vue": "^3.0.2"
|
|
29
29
|
},
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),M=require("@progress/kendo-webspeech-common"),R=require("@progress/kendo-vue-buttons"),h=require("@progress/kendo-svg-icons");function B(e){return new M.KendoSpeechRecognition(e)}let d=function(e){return e.WebSpeech="WebSpeech",e.None="None",e}({});const T=i.defineComponent({name:"KendoSpeechToTextButton",props:{lang:{type:String,default:"en-US"},continuous:{type:Boolean,default:!1},interimResults:{type:Boolean,default:!1},maxAlternatives:{type:Number,default:1},integrationMode:{type:String,default:d.WebSpeech},onStart:{type:Function},onResult:{type:Function},onEnd:{type:Function},onError:{type:Function},svgIcon:{type:Object,default:h.microphoneOutlineIcon},iconSize:{type:String,default:"medium"},disabled:{type:Boolean,default:void 0},size:{type:String,default:"medium"},rounded:{type:String,default:"medium"},fillMode:{type:String,default:"solid"},themeColor:{type:String,default:"base"},title:{type:String,default:"Speech to Text Button"},ariaLabel:{type:String,default:"Start speech recognition"}},setup(e,{emit:l,expose:f}){const o=i.ref(null),n=i.ref(!1),S=()=>{var t;return(t=o.value)==null?void 0:t.isActive()},r=()=>e.integrationMode!==d.None,u=()=>{var t;n.value||(r&&((t=o.value)==null||t.start()),n.value=!0)},a=()=>{var t;n.value&&(r&&((t=o.value)==null||t.stop()),n.value=!1)},v=()=>{n.value?c():s()},s=async()=>{n.value||e.onStart&&(await e.onStart(),u())},g=t=>{const p=t.results,A=p.length-1,b=p[A],x=Array.from(b).map(I=>({transcript:I.transcript,confidence:I.confidence}));l("result",{isFinal:b.isFinal,alternatives:x})},c=async()=>{n.value&&e.onEnd&&(await e.onEnd(),a())},m=t=>{l("error",t)},y=()=>{var t;e.integrationMode===d.WebSpeech&&((t=o.value)!=null&&t.isActive()&&a(),o.value=B({lang:e.lang,continuous:e.continuous,interimResults:e.interimResults,integrationMode:e.integrationMode,maxAlternatives:e.maxAlternatives,events:{start:s,result:g,end:c,error:m}}))};return i.watch(()=>({lang:e.lang,continuous:e.continuous,interimResults:e.interimResults,integrationMode:e.integrationMode,maxAlternatives:e.maxAlternatives}),()=>{y()},{deep:!0}),i.onMounted(()=>{y()}),i.onUnmounted(()=>{var t;(t=o.value)!=null&&t.isInActiveState&&a()}),f({start:u,stop:a,isActive:S}),{clickHandler:v,isInActiveState:n}},render(){const{ariaLabel:e,svgIcon:l,fillMode:f,rounded:o,size:n,disabled:S,themeColor:r,iconSize:u,title:a}=this.$props,{className:v,style:s,id:g}=this.$attrs,c=i.computed(()=>["k-speech-to-text-button",v,{"k-listening":this.isInActiveState}]),m=i.computed(()=>this.isInActiveState?h.stopSmIcon:l||h.microphoneOutlineIcon);return i.createVNode(R.Button,{id:g,style:s,class:c.value,onClick:this.clickHandler,svgIcon:m.value,iconSize:u,fillMode:f,rounded:o,size:n,themeColor:r,"aria-label":e,disabled:S,title:a},null)}});exports.SpeechToTextButton=T;exports.SpeechToTextButtonMode=d;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { defineComponent as M, computed as b, createVNode as z, ref as A, watch as B, onMounted as C, onUnmounted as E } from "vue";
|
|
9
|
+
import { KendoSpeechRecognition as F } from "@progress/kendo-webspeech-common";
|
|
10
|
+
import { Button as H } from "@progress/kendo-vue-buttons";
|
|
11
|
+
import { microphoneOutlineIcon as I, stopSmIcon as N } from "@progress/kendo-svg-icons";
|
|
12
|
+
function k(e) {
|
|
13
|
+
return new F(e);
|
|
14
|
+
}
|
|
15
|
+
let S = /* @__PURE__ */ function(e) {
|
|
16
|
+
return e.WebSpeech = "WebSpeech", e.None = "None", e;
|
|
17
|
+
}({});
|
|
18
|
+
const L = /* @__PURE__ */ M({
|
|
19
|
+
name: "KendoSpeechToTextButton",
|
|
20
|
+
props: {
|
|
21
|
+
lang: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "en-US"
|
|
24
|
+
},
|
|
25
|
+
continuous: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: !1
|
|
28
|
+
},
|
|
29
|
+
interimResults: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: !1
|
|
32
|
+
},
|
|
33
|
+
maxAlternatives: {
|
|
34
|
+
type: Number,
|
|
35
|
+
default: 1
|
|
36
|
+
},
|
|
37
|
+
integrationMode: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: S.WebSpeech
|
|
40
|
+
},
|
|
41
|
+
onStart: {
|
|
42
|
+
type: Function
|
|
43
|
+
},
|
|
44
|
+
onResult: {
|
|
45
|
+
type: Function
|
|
46
|
+
},
|
|
47
|
+
onEnd: {
|
|
48
|
+
type: Function
|
|
49
|
+
},
|
|
50
|
+
onError: {
|
|
51
|
+
type: Function
|
|
52
|
+
},
|
|
53
|
+
svgIcon: {
|
|
54
|
+
type: Object,
|
|
55
|
+
default: I
|
|
56
|
+
},
|
|
57
|
+
iconSize: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: "medium"
|
|
60
|
+
},
|
|
61
|
+
disabled: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: void 0
|
|
64
|
+
},
|
|
65
|
+
size: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: "medium"
|
|
68
|
+
},
|
|
69
|
+
rounded: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: "medium"
|
|
72
|
+
},
|
|
73
|
+
fillMode: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: "solid"
|
|
76
|
+
},
|
|
77
|
+
themeColor: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: "base"
|
|
80
|
+
},
|
|
81
|
+
title: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: "Speech to Text Button"
|
|
84
|
+
},
|
|
85
|
+
ariaLabel: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: "Start speech recognition"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
setup(e, {
|
|
91
|
+
emit: a,
|
|
92
|
+
expose: c
|
|
93
|
+
}) {
|
|
94
|
+
const i = A(null), n = A(!1), d = () => {
|
|
95
|
+
var t;
|
|
96
|
+
return (t = i.value) == null ? void 0 : t.isActive();
|
|
97
|
+
}, l = () => e.integrationMode !== S.None, r = () => {
|
|
98
|
+
var t;
|
|
99
|
+
n.value || (l && ((t = i.value) == null || t.start()), n.value = !0);
|
|
100
|
+
}, o = () => {
|
|
101
|
+
var t;
|
|
102
|
+
n.value && (l && ((t = i.value) == null || t.stop()), n.value = !1);
|
|
103
|
+
}, f = () => {
|
|
104
|
+
n.value ? u() : s();
|
|
105
|
+
}, s = async () => {
|
|
106
|
+
n.value || e.onStart && (await e.onStart(), r());
|
|
107
|
+
}, m = (t) => {
|
|
108
|
+
const h = t.results, R = h.length - 1, y = h[R], x = Array.from(y).map((p) => ({
|
|
109
|
+
transcript: p.transcript,
|
|
110
|
+
confidence: p.confidence
|
|
111
|
+
}));
|
|
112
|
+
a("result", {
|
|
113
|
+
isFinal: y.isFinal,
|
|
114
|
+
alternatives: x
|
|
115
|
+
});
|
|
116
|
+
}, u = async () => {
|
|
117
|
+
n.value && e.onEnd && (await e.onEnd(), o());
|
|
118
|
+
}, v = (t) => {
|
|
119
|
+
a("error", t);
|
|
120
|
+
}, g = () => {
|
|
121
|
+
var t;
|
|
122
|
+
e.integrationMode === S.WebSpeech && ((t = i.value) != null && t.isActive() && o(), i.value = k({
|
|
123
|
+
lang: e.lang,
|
|
124
|
+
continuous: e.continuous,
|
|
125
|
+
interimResults: e.interimResults,
|
|
126
|
+
integrationMode: e.integrationMode,
|
|
127
|
+
maxAlternatives: e.maxAlternatives,
|
|
128
|
+
events: {
|
|
129
|
+
start: s,
|
|
130
|
+
result: m,
|
|
131
|
+
end: u,
|
|
132
|
+
error: v
|
|
133
|
+
}
|
|
134
|
+
}));
|
|
135
|
+
};
|
|
136
|
+
return B(() => ({
|
|
137
|
+
lang: e.lang,
|
|
138
|
+
continuous: e.continuous,
|
|
139
|
+
interimResults: e.interimResults,
|
|
140
|
+
integrationMode: e.integrationMode,
|
|
141
|
+
maxAlternatives: e.maxAlternatives
|
|
142
|
+
}), () => {
|
|
143
|
+
g();
|
|
144
|
+
}, {
|
|
145
|
+
deep: !0
|
|
146
|
+
}), C(() => {
|
|
147
|
+
g();
|
|
148
|
+
}), E(() => {
|
|
149
|
+
var t;
|
|
150
|
+
(t = i.value) != null && t.isInActiveState && o();
|
|
151
|
+
}), c({
|
|
152
|
+
start: r,
|
|
153
|
+
stop: o,
|
|
154
|
+
isActive: d
|
|
155
|
+
}), {
|
|
156
|
+
clickHandler: f,
|
|
157
|
+
isInActiveState: n
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
render() {
|
|
161
|
+
const {
|
|
162
|
+
ariaLabel: e,
|
|
163
|
+
svgIcon: a,
|
|
164
|
+
fillMode: c,
|
|
165
|
+
rounded: i,
|
|
166
|
+
size: n,
|
|
167
|
+
disabled: d,
|
|
168
|
+
themeColor: l,
|
|
169
|
+
iconSize: r,
|
|
170
|
+
title: o
|
|
171
|
+
} = this.$props, {
|
|
172
|
+
className: f,
|
|
173
|
+
style: s,
|
|
174
|
+
id: m
|
|
175
|
+
} = this.$attrs, u = b(() => ["k-speech-to-text-button", f, {
|
|
176
|
+
"k-listening": this.isInActiveState
|
|
177
|
+
}]), v = b(() => this.isInActiveState ? N : a || I);
|
|
178
|
+
return z(H, {
|
|
179
|
+
id: m,
|
|
180
|
+
style: s,
|
|
181
|
+
class: u.value,
|
|
182
|
+
onClick: this.clickHandler,
|
|
183
|
+
svgIcon: v.value,
|
|
184
|
+
iconSize: r,
|
|
185
|
+
fillMode: c,
|
|
186
|
+
rounded: i,
|
|
187
|
+
size: n,
|
|
188
|
+
themeColor: l,
|
|
189
|
+
"aria-label": e,
|
|
190
|
+
disabled: d,
|
|
191
|
+
title: o
|
|
192
|
+
}, null);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
export {
|
|
196
|
+
L as SpeechToTextButton,
|
|
197
|
+
S as SpeechToTextButtonMode
|
|
198
|
+
};
|