@linker-design-plus/tiny-peony 1.4.15 → 1.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +15 -15
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -7
- package/dist/index.mjs.map +1 -1
- package/dist/intersection/components/editor/editor.d.ts +9 -9
- package/dist/intersection/components/editor/index.d.ts +15 -15
- package/dist/typings/intersection/editor.d.ts +4 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,10 +7,6 @@ declare const TinyPeony: {
|
|
|
7
7
|
type: StringConstructor;
|
|
8
8
|
default: string;
|
|
9
9
|
};
|
|
10
|
-
realTime: {
|
|
11
|
-
type: StringConstructor;
|
|
12
|
-
default: string;
|
|
13
|
-
};
|
|
14
10
|
textCount: {
|
|
15
11
|
type: NumberConstructor;
|
|
16
12
|
default: number;
|
|
@@ -66,6 +62,10 @@ declare const TinyPeony: {
|
|
|
66
62
|
type: (StringConstructor | NumberConstructor)[];
|
|
67
63
|
default: string;
|
|
68
64
|
};
|
|
65
|
+
showPreTime: {
|
|
66
|
+
type: BooleanConstructor;
|
|
67
|
+
default: boolean;
|
|
68
|
+
};
|
|
69
69
|
}>> & Readonly<{
|
|
70
70
|
onChange?: ((contentLength: number) => any) | undefined;
|
|
71
71
|
"onUpdate:textCount"?: ((value: number) => any) | undefined;
|
|
@@ -134,13 +134,13 @@ declare const TinyPeony: {
|
|
|
134
134
|
showWordLimit: boolean;
|
|
135
135
|
simple: boolean;
|
|
136
136
|
preTime: string;
|
|
137
|
-
realTime: string;
|
|
138
137
|
textCount: number;
|
|
139
138
|
listenAnchorId: string;
|
|
140
139
|
listenMode: import("./typings/shared").ListenModeEnum;
|
|
141
140
|
contentStyle: import("vue").CSSProperties;
|
|
142
141
|
refinable: boolean;
|
|
143
142
|
editorHeight: string | number;
|
|
143
|
+
showPreTime: boolean;
|
|
144
144
|
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
145
145
|
P: {};
|
|
146
146
|
B: {};
|
|
@@ -153,10 +153,6 @@ declare const TinyPeony: {
|
|
|
153
153
|
type: StringConstructor;
|
|
154
154
|
default: string;
|
|
155
155
|
};
|
|
156
|
-
realTime: {
|
|
157
|
-
type: StringConstructor;
|
|
158
|
-
default: string;
|
|
159
|
-
};
|
|
160
156
|
textCount: {
|
|
161
157
|
type: NumberConstructor;
|
|
162
158
|
default: number;
|
|
@@ -212,6 +208,10 @@ declare const TinyPeony: {
|
|
|
212
208
|
type: (StringConstructor | NumberConstructor)[];
|
|
213
209
|
default: string;
|
|
214
210
|
};
|
|
211
|
+
showPreTime: {
|
|
212
|
+
type: BooleanConstructor;
|
|
213
|
+
default: boolean;
|
|
214
|
+
};
|
|
215
215
|
}>> & Readonly<{
|
|
216
216
|
onChange?: ((contentLength: number) => any) | undefined;
|
|
217
217
|
"onUpdate:textCount"?: ((value: number) => any) | undefined;
|
|
@@ -274,13 +274,13 @@ declare const TinyPeony: {
|
|
|
274
274
|
showWordLimit: boolean;
|
|
275
275
|
simple: boolean;
|
|
276
276
|
preTime: string;
|
|
277
|
-
realTime: string;
|
|
278
277
|
textCount: number;
|
|
279
278
|
listenAnchorId: string;
|
|
280
279
|
listenMode: import("./typings/shared").ListenModeEnum;
|
|
281
280
|
contentStyle: import("vue").CSSProperties;
|
|
282
281
|
refinable: boolean;
|
|
283
282
|
editorHeight: string | number;
|
|
283
|
+
showPreTime: boolean;
|
|
284
284
|
}>;
|
|
285
285
|
__isFragment?: never;
|
|
286
286
|
__isTeleport?: never;
|
|
@@ -290,10 +290,6 @@ declare const TinyPeony: {
|
|
|
290
290
|
type: StringConstructor;
|
|
291
291
|
default: string;
|
|
292
292
|
};
|
|
293
|
-
realTime: {
|
|
294
|
-
type: StringConstructor;
|
|
295
|
-
default: string;
|
|
296
|
-
};
|
|
297
293
|
textCount: {
|
|
298
294
|
type: NumberConstructor;
|
|
299
295
|
default: number;
|
|
@@ -349,6 +345,10 @@ declare const TinyPeony: {
|
|
|
349
345
|
type: (StringConstructor | NumberConstructor)[];
|
|
350
346
|
default: string;
|
|
351
347
|
};
|
|
348
|
+
showPreTime: {
|
|
349
|
+
type: BooleanConstructor;
|
|
350
|
+
default: boolean;
|
|
351
|
+
};
|
|
352
352
|
}>> & Readonly<{
|
|
353
353
|
onChange?: ((contentLength: number) => any) | undefined;
|
|
354
354
|
"onUpdate:textCount"?: ((value: number) => any) | undefined;
|
|
@@ -417,13 +417,13 @@ declare const TinyPeony: {
|
|
|
417
417
|
showWordLimit: boolean;
|
|
418
418
|
simple: boolean;
|
|
419
419
|
preTime: string;
|
|
420
|
-
realTime: string;
|
|
421
420
|
textCount: number;
|
|
422
421
|
listenAnchorId: string;
|
|
423
422
|
listenMode: import("./typings/shared").ListenModeEnum;
|
|
424
423
|
contentStyle: import("vue").CSSProperties;
|
|
425
424
|
refinable: boolean;
|
|
426
425
|
editorHeight: string | number;
|
|
426
|
+
showPreTime: boolean;
|
|
427
427
|
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
|
|
428
428
|
install: (app: App, options?: Record<string, any>) => void;
|
|
429
429
|
} & {
|
package/dist/index.js
CHANGED
|
@@ -72,5 +72,5 @@ return ret;
|
|
|
72
72
|
shortcutPosition: ${R>N+M+BI?OA.底部:OA.顶部}
|
|
73
73
|
subShortcutPosition: ${R>N+M+BI+VC?zA.顶部对齐:zA.底部对齐}
|
|
74
74
|
`),o(R>N+M?wg.底部:wg.顶部),a(R>N+M+BI+8?OA.底部:OA.顶部),w(R>N+M+BI+VC?zA.顶部对齐:zA.底部对齐)},D=EI(l);return e.onMounted(()=>{var f;(f=B.value)==null||f.addEventListener("scroll",D)}),e.onUnmounted(()=>{var f;(f=B.value)==null||f.removeEventListener("scroll",D)}),{generatorPosition:n,shortcutPosition:s,subShortcutPosition:r,setGeneratorPosition:o,setShortcutPosition:a,setSubShortcutPosition:w,calcModalPosition:l}},[Jo]=bA("refine-generator"),Yo=e.defineComponent({name:"RefineGenerator",props:{width:{type:[Number,String],default:"100%"}},emits:{},setup:I=>{const{highlightRange:E,unhighlightRange:B,revertRange:n}=pt(),o=e.inject(ng),{agentId:s,createSession:a,sendSessionMessage:r,abortSession:w}=o.refineContext,[l,D]=LA(void 0),f=()=>(r.abort(),w({sessionId:l.value})),u=e.ref(),[F,R]=LA({zIndex:-10}),[N,M]=LA(!1,lA=>{lA||(l.value&&[YA.等待生成,YA.正在生成].includes(v.value)&&f(),D(void 0),tA(!1),nA(void 0),p(!1),O(YA.未生成),m(0),sA([]),Z(void 0),EA(!0),R({zIndex:-10}))}),G=()=>{var VA,jA,ZA,Qg;if(x(o)||x(o.editorCore.value))return;const lA=CB((VA=j.value)==null?void 0:VA.getBoundingClientRect(),(jA=Array.from(o.editorCore.value._editorElement.querySelectorAll(".tag-range-highlight")).pop())==null?void 0:jA.getBoundingClientRect(),1);R({top:`${lA.top+(((ZA=j.value)==null?void 0:ZA.scrollTop)??0)}px`,left:0,width:`${(Qg=o.editorCore.value)==null?void 0:Qg._editorElement.offsetWidth}px`})},S=()=>{x(o)||x(o.editorCore.value)||(G(),M(!0))},U=lA=>{var VA;N.value&&((VA=u.value)!=null&&VA.contains(lA.target)||(B(),M(!1)))},H=EI(()=>{N.value&&G()}),[j,X]=LA(void 0);e.onMounted(()=>{var lA;X(document.body.querySelector(".c-editor-container--refinable")),document.addEventListener("mousedown",U),(lA=j.value)==null||lA.addEventListener("scroll",H)}),e.onUnmounted(()=>{var lA;document.removeEventListener("mousedown",U),(lA=j.value)==null||lA.removeEventListener("scroll",H)});const K=le(I.width)?`${I.width}px`:I.width,[V,tA]=eI(),[CA,nA]=LA(void 0),[rA,EA]=eI(!0),[hA,p]=eI(),[v,O]=LA(YA.未生成),[z,m]=LA(0),[Y,sA]=LA([]),[dA,Z]=LA(void 0),QA={name:"RefineGenerator",refineGeneratorRef:u,visible:N,width:K,generating:V,prompt:CA,shortcutVisible:rA,content:Y,activedContent:dA,contentVisible:hA,contentPage:z,contentState:v,setVisible:M,setRefineGenerating:tA,setRefinePrompt:nA,setShortVisible:EA,setRefineContent:sA,setActivedRefineContent:Z,genRefineContent:async lA=>{var bg,kg;if(V.value)return;tA(!0),nA(void 0),sA((lA==null?void 0:lA.generateType)===yg.刷新?[...Y.value,{...Y.value[z.value-1],content:""}]:[Qg(lA)]),Z(Y.value[Y.value.length-1]),m(Y.value.length),O(YA.等待生成),D(IB());const VA=await a({agentId:s,sessionId:l.value});p(!0),O(YA.正在生成),r({messageRequest:{agent_id:s,message:{content:Array.from(document.body.querySelectorAll(`.${oI}`)).map(vA=>vA.textContent??"").join(`
|
|
75
|
-
`),conversation_id:VA.data.conversionId},meta_data:{ai_rewrite:((bg=dA.value)==null?void 0:bg.shortcutType)??((kg=dA.value)==null?void 0:kg.prompt),sessionId:l.value}}},{onmessage:ZA,onclose:()=>{console.log("---onclose "),jA()},onerror:vA=>{console.log("---onerror ",vA),jA()}});async function jA(){tA(!1),O(YA.未生成),await e.nextTick(),qA(),EA(!0)}function ZA(vA){const PA=JSON.parse(vA.data);PA.type==="answer"&&(dA.value.content+=(PA.content??"").replace(/\n{2,}/g,Kg).replace(/\n/g,Kg))}function Qg(vA){const PA=(vA==null?void 0:vA.generateType)===yg.重置;return{isManualPrompt:PA,prompt:PA?vA.prompt:void 0,shortcutType:PA?vA.shortcutType:void 0,content:""}}},setContentPage:m,setContentVisible:p,setContentState:O,showRefineGenerator:S,abortSession:f,scrollElm:j,highlightRange:E,unhighlightRange:B,revertRange:n},{generatorPosition:IA,shortcutPosition:yA,subShortcutPosition:cA,setGeneratorPosition:MA,setShortcutPosition:ig,setSubShortcutPosition:XA,calcModalPosition:qA}=mo(QA);return e.provide(xg,{...QA,generatorPosition:IA,shortcutPosition:yA,subShortcutPosition:cA,setGeneratorPosition:MA,setShortcutPosition:ig,setSubShortcutPosition:XA,calcModalPosition:qA}),{innerRender:()=>e.createVNode(e.Fragment,null,[e.createVNode(Uo,null,null),e.createVNode("div",{ref:u,class:"c-refine-generator-wrapper",style:{...F.value,display:N.value?"block":"none"}},[e.createVNode("div",{class:"c-refine-generator-wrapper__inner"},[e.createVNode("div",{class:Jo(),style:{width:K}},[e.createVNode(ho,{modelValue:Y.value,"onUpdate:modelValue":lA=>Y.value=lA},null),e.createVNode(Lo,{modelValue:CA.value,"onUpdate:modelValue":lA=>CA.value=lA},null)]),e.createVNode(Mo,null,null)])])]),innerSetVisible:M}},methods:{setVisible(I){this.innerSetVisible(I)}},render(){return this.innerRender()}}),Ho={};function Ko(I,E){return e.openBlock(),e.createElementBlock("svg",e.mergeProps({xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024","aria-hidden":"true",role:"img",class:"iconify iconify--mdi",width:"18",height:"18",preserveAspectRatio:"xMidYMid meet"},I.$attrs),E[0]||(E[0]=[e.createElementVNode("path",{d:"M843.0592 474.9312l-448-307.2-0.1024 0.1024A51.712 51.712 0 0 0 359.168 153.6c-28.5184 0-51.712 22.9376-51.712 51.2 0 15.5136-0.6144 45.9264 0 45.312V819.2c0 28.2624 23.1936 51.2 51.712 51.2 13.9776 0 26.624-5.4784 35.84-14.336h0.0512l448-307.2a50.7904 50.7904 0 0 0 15.872-36.864v-0.1024-0.1024a50.8416 50.8416 0 0 0-15.872-36.864z",fill:"currentColor"},null,-1)]),16)}const vo=GA(Ho,[["render",Ko]]),qo={};function xo(I,E){return e.openBlock(),e.createElementBlock("svg",e.mergeProps({xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024","aria-hidden":"true",role:"img",class:"iconify iconify--mdi",width:"18",height:"18",preserveAspectRatio:"xMidYMid meet"},I.$attrs),E[0]||(E[0]=[e.createElementVNode("path",{d:"M299.90284958 17.10664903a70.69905013 70.69905013 0 0 0-70.69905015 70.69905014v848.38860166a70.69905013 70.69905013 0 1 0 141.39810028 0V87.80569917a70.69905013 70.69905013 0 0 0-70.69905013-70.69905014z m424.19430084 0a70.69905013 70.69905013 0 0 0-70.69905013 70.69905014v848.38860166a70.69905013 70.69905013 0 1 0 141.39810028 0V87.80569917a70.69905013 70.69905013 0 0 0-70.69905015-70.69905014z",fill:"currentColor"},null,-1)]),16)}const bo=GA(qo,[["render",xo]]),To={};function Vo(I,E){return e.openBlock(),e.createElementBlock("svg",e.mergeProps({xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024","aria-hidden":"true",role:"img",class:"iconify iconify--mdi",width:"18",height:"18",preserveAspectRatio:"xMidYMid meet"},I.$attrs),E[0]||(E[0]=[e.createElementVNode("path",{d:"M512 56.888889a455.111111 455.111111 0 1 1 0 910.222222A455.111111 455.111111 0 0 1 512 56.888889z m0 401.521778L404.764444 351.118222a37.944889 37.944889 0 1 0-53.646222 53.646222L458.410667 512l-107.292445 107.235556a37.944889 37.944889 0 1 0 53.646222 53.646222L512 565.589333l107.235556 107.292445a37.944889 37.944889 0 1 0 53.646222-53.646222L565.589333 512l107.292445-107.235556a37.944889 37.944889 0 1 0-53.646222-53.646222L512 458.410667z",fill:"currentColor"},null,-1)]),16)}const PC=GA(To,[["render",Vo]]),[mA]=bA("editor-container"),[WA]=bA("anchor-item"),jC=e.defineComponent({name:"EditorContainer",props:{preTime:{type:String,default:"00:00:00"},realTime:{type:String,default:"00:00:00"},textCount:{type:Number,default:0},highlight:{type:Boolean,default:void 0},listenAnchorId:{type:String,default:"-1"},listenMode:{type:String,default:"single"},placeholder:{type:String,default:"请输入或者上传文稿"},simple:{type:Boolean,default:!1},maxLength:{type:Number,default:1e4},showWordLimit:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},class:{type:[String,Array],default:()=>[]},contentStyle:{type:Object,default:()=>({})},refinable:{type:Boolean,default:!1},refineContext:{type:Object},editorHeight:{type:[Number,String],default:"calc(100% - 62px)"}},emits:{change:I=>!0,"update:textCount":I=>!0,anchorListen:(I,E)=>!0,anchorListenStop:I=>!0,anchorRemove:I=>!0},setup:(I,{slots:E,emit:B})=>{const n=e.ref(),o=e.ref(),{editorCore:s,editorAction:a,count:r,hasPausationTag:w,getContent:l,setContent:D,appendContent:f,getTextContent:u,insertContent:F,deleteContent:R,updateContent:N,isCaret:M,isRange:G,isSelectionInDifferentParas:S,isSelectionContainsTag:U,getAnchorTtsMark:H,getAnchorTtsEmotionAndRole:j,isAllMarkedByAnchor:X,addExtraAnchors:K,clearContent:V,insertContentAtCursor:tA,renderHighlight:CA,unrenderHighlight:nA}=Lt(n,I,B);e.provide(ng,{name:"Editor",editorCore:s,editorAction:a,getContent:l,setContent:D,appendContent:f,getTextContent:u,insertContent:F,deleteContent:R,updateContent:N,isCaret:M,isRange:G,isSelectionContainsTag:U,getAnchorTtsMark:H,getAnchorTtsEmotionAndRole:j,isAllMarkedByAnchor:X,addExtraAnchors:K,clearContent:V,renderHighlight:CA,unrenderHighlight:nA,refineContext:I.refineContext});const rA=e.computed(()=>{var Z,BA;return((BA=(Z=s.value)==null?void 0:Z.plugin.anchor)==null?void 0:BA.data)??{}}),EA=e.computed(()=>Object.values(rA.value).flat().length),hA=e.computed(()=>r.value<=0&&!w.value),p=(Z,BA,QA)=>{let IA=Array.from(document.body.querySelectorAll(QA.uid?`span[data-uid="${QA.uid}"]`:`span[data-frag-id="anchor_${Z}"]`));QA.uid||(IA=IA.filter(yA=>!yA.dataset.uid)),IA.forEach(yA=>{var cA,MA;return(MA=(cA=a.value)==null?void 0:cA.plugin.anchor)==null?void 0:MA.remove(yA)}),B("anchorRemove",QA)},v=Z=>Object.entries(Z).filter(([BA,QA])=>!!QA.length).map(([BA,QA],IA)=>e.createVNode("div",{style:{position:"absolute",top:`${BA}px`,width:"100%",paddingLeft:"24px",transform:"translateY(-4px)"},class:[QA.length>1&&"multi-anchor","anchor-wrapper"]},[QA.length>1?QA.slice(0,6).map(({background:yA,data:cA,id:MA})=>O(MA,BA,yA,cA,!0)):O(QA[0].id,BA,QA[0].background,QA[0].data,!1),QA.length>6?e.createVNode(fA.Popover,{trigger:"click",position:"left",popupContainer:".c-editor-container__core-anchor",contentClass:"anchor-popover",contentStyle:{padding:"6px 12px"}},{default:()=>e.createVNode(fA.Button,{shape:"circle",style:{width:"28px",height:"28px",transform:"translate(8px, 3px)"}},{default:()=>[e.createVNode(rt,null,null)]}),content:()=>e.createVNode("div",{class:["multi-anchor",`anchor-popover-wrapper_${IA}`]},[QA.slice(6).map(({background:yA,data:cA,id:MA})=>O(MA,BA,yA,cA,!0,`.anchor-popover-wrapper_${IA}`))])}):null])),O=(Z,BA,QA,IA,yA=!1,cA=void 0)=>{const MA=()=>I.listenMode===IC.multiple||I.listenAnchorId!==`${IA.id}_${IA.uid}`?e.createVNode("span",{onClick:()=>B("anchorListen",IA,H(IA))},[e.createVNode(vo,{class:WA("info-play")},null)]):e.createVNode("span",{onClick:()=>B("anchorListenStop",IA)},[e.createVNode(bo,{class:WA("info-play")},null)]),ig=()=>{var TA;return e.createVNode("section",{class:WA(),style:{backgroundColor:QA}},[((TA=E.anchor)==null?void 0:TA.call(E,{anchor:IA,popupContainer:cA,listen:XA,listenStop:qA,update:z}))??e.createVNode("img",{src:IA.avatar,class:WA("avatar")},null),e.createVNode("section",{class:WA("info"),style:{display:yA?"none":"flex"}},[e.createVNode("span",{class:WA("info-name"),title:IA.name},[IA.name]),e.createVNode("label",{class:WA("info-speed-volume")},[e.createTextVNode("语速: "),IA.speed,e.createTextVNode(", 音量: "),IA.volume]),e.createVNode("div",{onClick:()=>p(Z,BA,IA)},[e.createVNode(PC,{class:WA("info-rem")},null)]),MA()]),yA?e.createVNode("div",{class:WA("rem"),onClick:()=>p(Z,BA,IA)},[e.createVNode(PC,{class:WA("info-rem")},null)]):null])},XA=()=>B("anchorListen",IA,H(IA)),qA=()=>B("anchorListenStop",IA);return ig()},z=Z=>{const{uid:BA}=Z,{id:QA}=Z,IA=Object.keys(rA.value);for(let cA=0;cA<IA.length;cA++){const MA=IA[cA],XA=rA.value[MA].findIndex(qA=>qA.data.uid?qA.data.uid===BA:qA.id===QA);if(XA>-1){const qA=rA.value[MA][XA];rA.value[MA].splice(XA,1,{...qA,data:{...Z}});break}}let yA=Array.from(document.body.querySelectorAll(BA?`span[data-uid="${BA}"]`:`span[data-frag-id="anchor_${QA}"]`));BA||(yA=yA.filter(cA=>!cA.dataset.uid)),yA.forEach(cA=>Object.assign(cA.dataset,{provider:Z.provider,person:Z.person,volume:Z.volumn||Z.volume,speed:Z.speed,emotion:Z.activeEmotion,role:Z.activeRole??"",name:Z.name}))},m=()=>{},Y=()=>{var Z;return e.createVNode("div",{class:mA("status",{simple:I.simple,disabled:I.disabled})},[((Z=E["footer-left"])==null?void 0:Z.call(E))??(I.simple?null:e.createVNode(fA.Button,{class:mA("status-clear"),onClick:V},{default:()=>[e.createTextVNode("清空")]})),e.createVNode("div",{class:mA("status-info")},[I.simple?null:e.createVNode(e.Fragment,null,[e.createVNode("label",{class:mA("status-info-label")},[e.createVNode("span",null,[e.createTextVNode("预计时长:")]),e.createVNode("span",null,[I.preTime||"00:00:00"])]),e.createVNode("label",{class:mA("status-info-label")},[e.createVNode("span",null,[e.createTextVNode("实际时长:")]),e.createVNode("span",null,[I.realTime||"00:00:00"])])]),I.showWordLimit?e.createVNode("label",{class:mA("status-info-length")},[e.createVNode("span",null,[r.value<=I.maxLength?r.value:I.maxLength]),e.createVNode("span",null,[e.createTextVNode(" / ")]),e.createVNode("span",null,[I.maxLength,I.simple?"":"字"])]):null])])},sA=e.ref();return{action:a,innerRender:()=>e.createVNode("section",{class:mA("wrapper")},[e.createVNode("div",{class:mA("",{simple:I.simple,disabled:I.disabled,refinable:I.refinable}),style:{height:de(I.editorHeight)?I.editorHeight:`${I.editorHeight}px`}},[!I.simple&&m(),e.createVNode("div",{class:mA("core")},[e.createVNode("div",{class:mA("core-content")},[e.createVNode("div",{class:mA("core-content-editor")},[e.createVNode("div",{class:mA("core-content-editor-placeholder"),style:{display:hA.value?"block":"none"}},[I.placeholder]),e.createVNode("div",{ref:n,class:mA("core-content-editor-content"),contenteditable:!I.disabled,onDragover:Z=>Z.preventDefault(),onDrop:Z=>Z.preventDefault()},[e.createVNode("p",{class:NA},[e.createVNode("br",null,null)])])])]),I.simple?null:e.createVNode("div",{ref:o,class:mA("core-anchor")},[EA.value?v(rA.value):null])]),!I.simple&&e.createVNode(Ht,null,null),I.refinable&&e.createVNode(Yo,{ref:sA},null)]),!I.simple&&e.createVNode("div",{class:mA("splitor")},null),!I.simple&&!Object.values(rA.value).flat().length?e.createVNode("div",{class:mA("anchor-placeholder")},[e.createVNode("img",{src:Mt},null)]):null,Y(),e.createVNode("span",{style:"display: none"},[JSON.stringify(rA.value),Object.values(rA.value).flat().length])]),innerGetContent:l,innerSetContent:D,innerAppendContent:f,innerGetTextContent:u,innerInsertContent:F,innerDeleteContent:R,innerUpdateContent:N,innerIsCaret:M,innerIsRange:G,innerIsSelectionInDifferentParas:S,innerIsSelectionContainsTag:U,innerGetAnchorTtsMark:H,innerGetAnchorTtsEmotionAndRole:j,innerIsAllMarkedByAnchor:X,innerAddExtraAnchors:K,innerUpdateAnchor:z,innerClearContent:V,innerInsertContentAtCursor:tA,innerRenderHightlight:CA,innerUnrenderHightlight:nA}},methods:{getContent(I){return this.innerGetContent(I)},getHtml(I){return this.getContent(I)},setContent(I){return this.innerSetContent(I)},setHtml(I){return this.setContent(I)},appendContent(I){return this.innerAppendContent(I)},getTextContent(){return this.innerGetTextContent()},insertContent(I){return this.innerInsertContent(I)},deleteContent(){return this.innerDeleteContent()},updateContent(I){return this.innerUpdateContent(I)},isCaret(){return this.innerIsCaret()},isRange(){return this.innerIsRange()},isSelectionInDifferentParas(){return this.innerIsSelectionInDifferentParas()},isSelectionContainsTag(I){return this.innerIsSelectionContainsTag(I)},getAnchorTtsMark(I,E=!1){return this.innerGetAnchorTtsMark(I,E)},getAnchorTtsEmotionAndRole(I){return this.innerGetAnchorTtsEmotionAndRole(I)},isAllMarkedByAnchor(){return this.innerIsAllMarkedByAnchor()},addExtraAnchors(I){return this.innerAddExtraAnchors(I)},updateAnchor(I){return this.innerUpdateAnchor(I)},clearContent(){return this.innerClearContent()},insertContentAtCursor(I){return this.innerInsertContentAtCursor(I)},clear(){return this.setContent(`<p class="${NA}"><br /></p>`)},renderHighlight(I){return this.innerRenderHightlight(I)},unrenderHighlight(){return this.innerUnrenderHightlight()}},render(){return this.innerRender()}}),OI=Object.assign(jC,{install:(I,E)=>{I.component("EditorContainer",jC)}}),Po=Object.assign(OI,{install:I=>{I.component(OI.name,OI)}});exports.ICommandExecutor=gB;exports.IContentManager=_C;exports.ICursorManager=$C;exports.IEditorCore=ZC;exports.IPlugin=qg;exports.IUndoManager=AB;exports.ListenModeEnum=IC;exports.PluginFlag=q;exports.SelectionType=XC;exports.default=Po;
|
|
75
|
+
`),conversation_id:VA.data.conversionId},meta_data:{ai_rewrite:((bg=dA.value)==null?void 0:bg.shortcutType)??((kg=dA.value)==null?void 0:kg.prompt),sessionId:l.value}}},{onmessage:ZA,onclose:()=>{console.log("---onclose "),jA()},onerror:vA=>{console.log("---onerror ",vA),jA()}});async function jA(){tA(!1),O(YA.未生成),await e.nextTick(),qA(),EA(!0)}function ZA(vA){const PA=JSON.parse(vA.data);PA.type==="answer"&&(dA.value.content+=(PA.content??"").replace(/\n{2,}/g,Kg).replace(/\n/g,Kg))}function Qg(vA){const PA=(vA==null?void 0:vA.generateType)===yg.重置;return{isManualPrompt:PA,prompt:PA?vA.prompt:void 0,shortcutType:PA?vA.shortcutType:void 0,content:""}}},setContentPage:m,setContentVisible:p,setContentState:O,showRefineGenerator:S,abortSession:f,scrollElm:j,highlightRange:E,unhighlightRange:B,revertRange:n},{generatorPosition:IA,shortcutPosition:yA,subShortcutPosition:cA,setGeneratorPosition:MA,setShortcutPosition:ig,setSubShortcutPosition:XA,calcModalPosition:qA}=mo(QA);return e.provide(xg,{...QA,generatorPosition:IA,shortcutPosition:yA,subShortcutPosition:cA,setGeneratorPosition:MA,setShortcutPosition:ig,setSubShortcutPosition:XA,calcModalPosition:qA}),{innerRender:()=>e.createVNode(e.Fragment,null,[e.createVNode(Uo,null,null),e.createVNode("div",{ref:u,class:"c-refine-generator-wrapper",style:{...F.value,display:N.value?"block":"none"}},[e.createVNode("div",{class:"c-refine-generator-wrapper__inner"},[e.createVNode("div",{class:Jo(),style:{width:K}},[e.createVNode(ho,{modelValue:Y.value,"onUpdate:modelValue":lA=>Y.value=lA},null),e.createVNode(Lo,{modelValue:CA.value,"onUpdate:modelValue":lA=>CA.value=lA},null)]),e.createVNode(Mo,null,null)])])]),innerSetVisible:M}},methods:{setVisible(I){this.innerSetVisible(I)}},render(){return this.innerRender()}}),Ho={};function Ko(I,E){return e.openBlock(),e.createElementBlock("svg",e.mergeProps({xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024","aria-hidden":"true",role:"img",class:"iconify iconify--mdi",width:"18",height:"18",preserveAspectRatio:"xMidYMid meet"},I.$attrs),E[0]||(E[0]=[e.createElementVNode("path",{d:"M843.0592 474.9312l-448-307.2-0.1024 0.1024A51.712 51.712 0 0 0 359.168 153.6c-28.5184 0-51.712 22.9376-51.712 51.2 0 15.5136-0.6144 45.9264 0 45.312V819.2c0 28.2624 23.1936 51.2 51.712 51.2 13.9776 0 26.624-5.4784 35.84-14.336h0.0512l448-307.2a50.7904 50.7904 0 0 0 15.872-36.864v-0.1024-0.1024a50.8416 50.8416 0 0 0-15.872-36.864z",fill:"currentColor"},null,-1)]),16)}const vo=GA(Ho,[["render",Ko]]),qo={};function xo(I,E){return e.openBlock(),e.createElementBlock("svg",e.mergeProps({xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024","aria-hidden":"true",role:"img",class:"iconify iconify--mdi",width:"18",height:"18",preserveAspectRatio:"xMidYMid meet"},I.$attrs),E[0]||(E[0]=[e.createElementVNode("path",{d:"M299.90284958 17.10664903a70.69905013 70.69905013 0 0 0-70.69905015 70.69905014v848.38860166a70.69905013 70.69905013 0 1 0 141.39810028 0V87.80569917a70.69905013 70.69905013 0 0 0-70.69905013-70.69905014z m424.19430084 0a70.69905013 70.69905013 0 0 0-70.69905013 70.69905014v848.38860166a70.69905013 70.69905013 0 1 0 141.39810028 0V87.80569917a70.69905013 70.69905013 0 0 0-70.69905015-70.69905014z",fill:"currentColor"},null,-1)]),16)}const bo=GA(qo,[["render",xo]]),To={};function Vo(I,E){return e.openBlock(),e.createElementBlock("svg",e.mergeProps({xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024","aria-hidden":"true",role:"img",class:"iconify iconify--mdi",width:"18",height:"18",preserveAspectRatio:"xMidYMid meet"},I.$attrs),E[0]||(E[0]=[e.createElementVNode("path",{d:"M512 56.888889a455.111111 455.111111 0 1 1 0 910.222222A455.111111 455.111111 0 0 1 512 56.888889z m0 401.521778L404.764444 351.118222a37.944889 37.944889 0 1 0-53.646222 53.646222L458.410667 512l-107.292445 107.235556a37.944889 37.944889 0 1 0 53.646222 53.646222L512 565.589333l107.235556 107.292445a37.944889 37.944889 0 1 0 53.646222-53.646222L565.589333 512l107.292445-107.235556a37.944889 37.944889 0 1 0-53.646222-53.646222L512 458.410667z",fill:"currentColor"},null,-1)]),16)}const PC=GA(To,[["render",Vo]]),[mA]=bA("editor-container"),[WA]=bA("anchor-item"),jC=e.defineComponent({name:"EditorContainer",props:{preTime:{type:String,default:"00:00:00"},textCount:{type:Number,default:0},highlight:{type:Boolean,default:void 0},listenAnchorId:{type:String,default:"-1"},listenMode:{type:String,default:"single"},placeholder:{type:String,default:"请输入或者上传文稿"},simple:{type:Boolean,default:!1},maxLength:{type:Number,default:1e4},showWordLimit:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},class:{type:[String,Array],default:()=>[]},contentStyle:{type:Object,default:()=>({})},refinable:{type:Boolean,default:!1},refineContext:{type:Object},editorHeight:{type:[Number,String],default:"calc(100% - 62px)"},showPreTime:{type:Boolean,default:!1}},emits:{change:I=>!0,"update:textCount":I=>!0,anchorListen:(I,E)=>!0,anchorListenStop:I=>!0,anchorRemove:I=>!0},setup:(I,{slots:E,emit:B})=>{const n=e.ref(),o=e.ref(),{editorCore:s,editorAction:a,count:r,hasPausationTag:w,getContent:l,setContent:D,appendContent:f,getTextContent:u,insertContent:F,deleteContent:R,updateContent:N,isCaret:M,isRange:G,isSelectionInDifferentParas:S,isSelectionContainsTag:U,getAnchorTtsMark:H,getAnchorTtsEmotionAndRole:j,isAllMarkedByAnchor:X,addExtraAnchors:K,clearContent:V,insertContentAtCursor:tA,renderHighlight:CA,unrenderHighlight:nA}=Lt(n,I,B);e.provide(ng,{name:"Editor",editorCore:s,editorAction:a,getContent:l,setContent:D,appendContent:f,getTextContent:u,insertContent:F,deleteContent:R,updateContent:N,isCaret:M,isRange:G,isSelectionContainsTag:U,getAnchorTtsMark:H,getAnchorTtsEmotionAndRole:j,isAllMarkedByAnchor:X,addExtraAnchors:K,clearContent:V,renderHighlight:CA,unrenderHighlight:nA,refineContext:I.refineContext});const rA=e.computed(()=>{var Z,BA;return((BA=(Z=s.value)==null?void 0:Z.plugin.anchor)==null?void 0:BA.data)??{}}),EA=e.computed(()=>Object.values(rA.value).flat().length),hA=e.computed(()=>r.value<=0&&!w.value),p=(Z,BA,QA)=>{let IA=Array.from(document.body.querySelectorAll(QA.uid?`span[data-uid="${QA.uid}"]`:`span[data-frag-id="anchor_${Z}"]`));QA.uid||(IA=IA.filter(yA=>!yA.dataset.uid)),IA.forEach(yA=>{var cA,MA;return(MA=(cA=a.value)==null?void 0:cA.plugin.anchor)==null?void 0:MA.remove(yA)}),B("anchorRemove",QA)},v=Z=>Object.entries(Z).filter(([BA,QA])=>!!QA.length).map(([BA,QA],IA)=>e.createVNode("div",{style:{position:"absolute",top:`${BA}px`,width:"100%",paddingLeft:"24px",transform:"translateY(-4px)"},class:[QA.length>1&&"multi-anchor","anchor-wrapper"]},[QA.length>1?QA.slice(0,6).map(({background:yA,data:cA,id:MA})=>O(MA,BA,yA,cA,!0)):O(QA[0].id,BA,QA[0].background,QA[0].data,!1),QA.length>6?e.createVNode(fA.Popover,{trigger:"click",position:"left",popupContainer:".c-editor-container__core-anchor",contentClass:"anchor-popover",contentStyle:{padding:"6px 12px"}},{default:()=>e.createVNode(fA.Button,{shape:"circle",style:{width:"28px",height:"28px",transform:"translate(8px, 3px)"}},{default:()=>[e.createVNode(rt,null,null)]}),content:()=>e.createVNode("div",{class:["multi-anchor",`anchor-popover-wrapper_${IA}`]},[QA.slice(6).map(({background:yA,data:cA,id:MA})=>O(MA,BA,yA,cA,!0,`.anchor-popover-wrapper_${IA}`))])}):null])),O=(Z,BA,QA,IA,yA=!1,cA=void 0)=>{const MA=()=>I.listenMode===IC.multiple||I.listenAnchorId!==`${IA.id}_${IA.uid}`?e.createVNode("span",{onClick:()=>B("anchorListen",IA,H(IA))},[e.createVNode(vo,{class:WA("info-play")},null)]):e.createVNode("span",{onClick:()=>B("anchorListenStop",IA)},[e.createVNode(bo,{class:WA("info-play")},null)]),ig=()=>{var TA;return e.createVNode("section",{class:WA(),style:{backgroundColor:QA}},[((TA=E.anchor)==null?void 0:TA.call(E,{anchor:IA,popupContainer:cA,listen:XA,listenStop:qA,update:z}))??e.createVNode("img",{src:IA.avatar,class:WA("avatar")},null),e.createVNode("section",{class:WA("info"),style:{display:yA?"none":"flex"}},[e.createVNode("span",{class:WA("info-name"),title:IA.name},[IA.name]),e.createVNode("label",{class:WA("info-speed-volume")},[e.createTextVNode("语速: "),IA.speed,e.createTextVNode(", 音量: "),IA.volume]),e.createVNode("div",{onClick:()=>p(Z,BA,IA)},[e.createVNode(PC,{class:WA("info-rem")},null)]),MA()]),yA?e.createVNode("div",{class:WA("rem"),onClick:()=>p(Z,BA,IA)},[e.createVNode(PC,{class:WA("info-rem")},null)]):null])},XA=()=>B("anchorListen",IA,H(IA)),qA=()=>B("anchorListenStop",IA);return ig()},z=Z=>{const{uid:BA}=Z,{id:QA}=Z,IA=Object.keys(rA.value);for(let cA=0;cA<IA.length;cA++){const MA=IA[cA],XA=rA.value[MA].findIndex(qA=>qA.data.uid?qA.data.uid===BA:qA.id===QA);if(XA>-1){const qA=rA.value[MA][XA];rA.value[MA].splice(XA,1,{...qA,data:{...Z}});break}}let yA=Array.from(document.body.querySelectorAll(BA?`span[data-uid="${BA}"]`:`span[data-frag-id="anchor_${QA}"]`));BA||(yA=yA.filter(cA=>!cA.dataset.uid)),yA.forEach(cA=>Object.assign(cA.dataset,{provider:Z.provider,person:Z.person,volume:Z.volumn||Z.volume,speed:Z.speed,emotion:Z.activeEmotion,role:Z.activeRole??"",name:Z.name}))},m=()=>{},Y=()=>{var Z;return e.createVNode("div",{class:mA("status",{simple:I.simple,disabled:I.disabled})},[((Z=E["footer-left"])==null?void 0:Z.call(E))??(I.simple?null:e.createVNode(fA.Button,{class:mA("status-clear"),onClick:V},{default:()=>[e.createTextVNode("清空")]})),e.createVNode("div",{class:mA("status-info")},[I.simple?I.showPreTime?e.createVNode("label",{class:mA("status-info-label")},[e.createVNode("span",null,[e.createTextVNode("预计时长:")]),e.createVNode("span",null,[I.preTime||"00:00:00"])]):null:e.createVNode(e.Fragment,null,[e.createVNode("label",{class:mA("status-info-label")},[e.createVNode("span",null,[e.createTextVNode("预计时长:")]),e.createVNode("span",null,[I.preTime||"00:00:00"])])]),I.showWordLimit?e.createVNode("label",{class:mA("status-info-length")},[e.createVNode("span",null,[r.value<=I.maxLength?r.value:I.maxLength]),e.createVNode("span",null,[e.createTextVNode(" / ")]),e.createVNode("span",null,[I.maxLength,I.simple?"":"字"])]):null])])},sA=e.ref();return{action:a,innerRender:()=>e.createVNode("section",{class:mA("wrapper")},[e.createVNode("div",{class:mA("",{simple:I.simple,disabled:I.disabled,refinable:I.refinable}),style:{height:de(I.editorHeight)?I.editorHeight:`${I.editorHeight}px`}},[!I.simple&&m(),e.createVNode("div",{class:mA("core")},[e.createVNode("div",{class:mA("core-content")},[e.createVNode("div",{class:mA("core-content-editor")},[e.createVNode("div",{class:mA("core-content-editor-placeholder"),style:{display:hA.value?"block":"none"}},[I.placeholder]),e.createVNode("div",{ref:n,class:mA("core-content-editor-content"),contenteditable:!I.disabled,onDragover:Z=>Z.preventDefault(),onDrop:Z=>Z.preventDefault()},[e.createVNode("p",{class:NA},[e.createVNode("br",null,null)])])])]),I.simple?null:e.createVNode("div",{ref:o,class:mA("core-anchor")},[EA.value?v(rA.value):null])]),!I.simple&&e.createVNode(Ht,null,null),I.refinable&&e.createVNode(Yo,{ref:sA},null)]),!I.simple&&e.createVNode("div",{class:mA("splitor")},null),!I.simple&&!Object.values(rA.value).flat().length?e.createVNode("div",{class:mA("anchor-placeholder")},[e.createVNode("img",{src:Mt},null)]):null,Y(),e.createVNode("span",{style:"display: none"},[JSON.stringify(rA.value),Object.values(rA.value).flat().length])]),innerGetContent:l,innerSetContent:D,innerAppendContent:f,innerGetTextContent:u,innerInsertContent:F,innerDeleteContent:R,innerUpdateContent:N,innerIsCaret:M,innerIsRange:G,innerIsSelectionInDifferentParas:S,innerIsSelectionContainsTag:U,innerGetAnchorTtsMark:H,innerGetAnchorTtsEmotionAndRole:j,innerIsAllMarkedByAnchor:X,innerAddExtraAnchors:K,innerUpdateAnchor:z,innerClearContent:V,innerInsertContentAtCursor:tA,innerRenderHightlight:CA,innerUnrenderHightlight:nA}},methods:{getContent(I){return this.innerGetContent(I)},getHtml(I){return this.getContent(I)},setContent(I){return this.innerSetContent(I)},setHtml(I){return this.setContent(I)},appendContent(I){return this.innerAppendContent(I)},getTextContent(){return this.innerGetTextContent()},insertContent(I){return this.innerInsertContent(I)},deleteContent(){return this.innerDeleteContent()},updateContent(I){return this.innerUpdateContent(I)},isCaret(){return this.innerIsCaret()},isRange(){return this.innerIsRange()},isSelectionInDifferentParas(){return this.innerIsSelectionInDifferentParas()},isSelectionContainsTag(I){return this.innerIsSelectionContainsTag(I)},getAnchorTtsMark(I,E=!1){return this.innerGetAnchorTtsMark(I,E)},getAnchorTtsEmotionAndRole(I){return this.innerGetAnchorTtsEmotionAndRole(I)},isAllMarkedByAnchor(){return this.innerIsAllMarkedByAnchor()},addExtraAnchors(I){return this.innerAddExtraAnchors(I)},updateAnchor(I){return this.innerUpdateAnchor(I)},clearContent(){return this.innerClearContent()},insertContentAtCursor(I){return this.innerInsertContentAtCursor(I)},clear(){return this.setContent(`<p class="${NA}"><br /></p>`)},renderHighlight(I){return this.innerRenderHightlight(I)},unrenderHighlight(){return this.innerUnrenderHightlight()}},render(){return this.innerRender()}}),OI=Object.assign(jC,{install:(I,E)=>{I.component("EditorContainer",jC)}}),Po=Object.assign(OI,{install:I=>{I.component(OI.name,OI)}});exports.ICommandExecutor=gB;exports.IContentManager=_C;exports.ICursorManager=$C;exports.IEditorCore=ZC;exports.IPlugin=qg;exports.IUndoManager=AB;exports.ListenModeEnum=IC;exports.PluginFlag=q;exports.SelectionType=XC;exports.default=Po;
|
|
76
76
|
//# sourceMappingURL=index.js.map
|