@vunk/plus 1.16.1 → 1.16.2

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),m=require("@vunk/plus/components/bubble-templates"),$=require("element-plus"),g=require("@vunk/plus/vue-virtual-scroller"),R=require("@element-plus/icons-vue"),x=require("@vueuse/core"),w=require("@vunk/plus/components/scrollbar"),B=require("@vunk/plus/element/bubble"),V=require("../_plugin-vue_export-helper-BHFhmbuH.js"),z=require("@vunk/shared/function"),P=require("@vunk/plus/components/agent-chat-provider"),F={},N={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1",width:"704",height:"704",viewBox:"0 0 704 704"};function q(l,i){return e.openBlock(),e.createElementBlock("svg",N,[...i[0]||(i[0]=[e.createStaticVNode('<defs><filter id="master_svg0_62_10054" filterUnits="objectBoundingBox" color-interpolation-filters="sRGB" x="-0.030120481927710843" y="-0.030120481927710843" width="1.0602409638554218" height="1.0602409638554218"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="5" result="effect1_foregroundBlur"></feGaussianBlur></filter><linearGradient id="master_svg1_62_10082" x1="0.5" y1="-0.13192443549633026" x2="0.42319029569625854" y2="1.368432641029358"><stop offset="9.145302325487137%" stop-color="currentColor" stop-opacity="1"></stop><stop offset="13.636428117752075%" stop-color="currentColor" stop-opacity="0.07539999485015869"></stop><stop offset="16.968481242656708%" stop-color="currentColor" stop-opacity="0"></stop></linearGradient></defs><g transform="matrix(0,1,-1,0,704,-664)" filter="url(#master_svg0_62_10054)"><path d="M1016,684C1199.359,684,1348,535.359,1348,352C1348,168.641,1199.359,20,1016,20C832.641,20,684,168.641,684,352C684,535.359,832.641,684,1016,684ZM1016,32C1192.731,32,1336,175.269,1336,352C1336,528.731,1192.731,672,1016,672C839.269,672,696,528.731,696,352C696,175.269,839.269,32,1016,32Z" fill-rule="evenodd" fill="url(#master_svg1_62_10082)" fill-opacity="1"></path></g>',2)])])}const A=V._export_sfc(F,[["render",q]]),E={class:"vk-bubble-list-wrapper"},I=e.defineComponent({__name:"index",props:{list:{type:Array,default:()=>[]},autoScroll:{type:Boolean,default:!0},autoScrollThreshold:{type:Number,default:200},maxHeight:{type:String,default:""},alwaysShowScrollbar:{type:Boolean,default:!1},backButtonThreshold:{type:Number,default:80},showBackButton:{type:Boolean,default:!0},backButtonPosition:{type:Object,default:()=>({bottom:"20px",left:"calc(50% - 19px)"})},btnLoading:{type:Boolean,default:!0},btnColor:{type:String,default:"#409EFF"},btnIconSize:{type:Number,default:24},scrollbarAppendTo:{type:null,default:void 0},virtual:{type:Boolean,default:!1},keyField:{type:String,default:"key"}},emits:{complete:null},setup(l,{expose:i}){const r=l,n=e.ref(),a=e.ref(),v=e.ref();function u(){document.documentElement.style.setProperty("--el-bubble-list-max-height",r.maxHeight||"100%"),document.documentElement.style.setProperty("--el-bubble-list-btn-size",`${r.btnIconSize}px`)}e.onMounted(()=>{u(),r.virtual&&e.nextTick(()=>{const o=n.value?.wrapRef;o&&(v.value=o)}),setTimeout(p)}),e.watch(()=>[r.maxHeight,r.btnIconSize],()=>u());const s=e.ref(),S=e.computed(()=>r.showBackButton&&s.value!==void 0&&s.value>r.backButtonThreshold);function p(){const o=n.value?.wrapRef;if(o)return s.value=o.scrollHeight-o.scrollTop-o.clientHeight,s.value}function h(){if(r.virtual){a.value?.scrollToBottom();return}n.value?.scrollToBottom()}function C(){if(r.virtual){a.value?.scrollToItem(0);return}n.value?.scrollToTop()}function T(o){if(r.virtual){a.value?.scrollToItem(o),requestAnimationFrame(()=>{requestAnimationFrame(()=>{a.value?.scrollToItem(o)})});return}const c=n.value?.wrapRef;if(!c)return;const b=c.querySelectorAll(".el-bubble");if(o>=b.length)return;const t=b[o],d=c.getBoundingClientRect(),y=t.getBoundingClientRect();c.scrollTo({top:y.top-d.top+c.scrollTop,behavior:"smooth"})}const k=e.ref();return e.onMounted(()=>{e.nextTick(()=>{k.value=n.value?.wrapRef?.firstElementChild})}),r.autoScroll&&x.useResizeObserver(k,()=>{const o=p();o!==void 0&&o>r.autoScrollThreshold||h()}),i({scrollToTop:C,scrollToBottom:h,scrollToBubble:T}),(o,c)=>{const b=e.resolveComponent("el-icon");return e.openBlock(),e.createElementBlock("div",E,[l.virtual?(e.openBlock(),e.createElementBlock("div",{key:0,class:"vk-bubble-list-virtual-host",style:e.normalizeStyle({height:l.maxHeight||"100%"})},[e.createVNode(e.unref(w.VkScrollbar),{ref_key:"scrollbarRef",ref:n,class:"vk-bubble-list-virtual-scrollbar",always:l.alwaysShowScrollbar,"hide-after":800,onScroll:p},{default:e.withCtx(()=>[v.value?(e.openBlock(),e.createBlock(e.unref(g.DynamicScroller),{key:0,ref_key:"scrollerRef",ref:a,items:l.list,"min-item-size":54,"key-field":l.keyField,"page-mode":!0,"scroll-parent":v.value,class:"vk-bubble-list-dynamic-scroller"},{default:e.withCtx(({item:t,index:d,active:y})=>[e.createVNode(e.unref(g.DynamicScrollerItem),{item:t,active:y,"data-index":d,class:"vk-bubble-list-virtual-item"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.Bubble),{content:t.content,placement:t.placement,loading:t.loading,shape:t.shape,variant:t.variant,"is-markdown":t.isMarkdown,"is-fog":t.isFog,typing:t.typing,"max-width":t.maxWidth,avatar:t.avatar,"avatar-size":t.avatarSize,"avatar-gap":t.avatarGap,"avatar-shape":t.avatarShape,"avatar-src-set":t.avatarSrcSet,"avatar-alt":t.avatarAlt,"avatar-fit":t.avatarFit,"no-style":t.noStyle,class:e.normalizeClass({[`is-${t.role}`]:!0})},e.createSlots({_:2},[o.$slots.avatar?{name:"avatar",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"avatar",{item:t})]),key:"0"}:void 0,o.$slots.header?{name:"header",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"header",{item:t})]),key:"1"}:void 0,o.$slots.content?{name:"content",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"content",{item:t})]),key:"2"}:void 0,o.$slots.footer?{name:"footer",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"footer",{item:t})]),key:"3"}:void 0,o.$slots.loading?{name:"loading",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"loading",{item:t})]),key:"4"}:void 0]),1032,["content","placement","loading","shape","variant","is-markdown","is-fog","typing","max-width","avatar","avatar-size","avatar-gap","avatar-shape","avatar-src-set","avatar-alt","avatar-fit","no-style","class"])]),_:2},1032,["item","active","data-index"])]),_:3},8,["items","key-field","scroll-parent"])):e.createCommentVNode("",!0)]),_:3},8,["always"])],4)):(e.openBlock(),e.createBlock(e.unref(w.VkScrollbar),{key:1,ref_key:"scrollbarRef",ref:n,class:"vk-bubble-list","append-to":l.scrollbarAppendTo,always:l.alwaysShowScrollbar,"hide-after":800,onScroll:p},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.list,(t,d)=>(e.openBlock(),e.createBlock(e.unref(B.Bubble),{key:t.key||d,content:t.content,placement:t.placement,loading:t.loading,shape:t.shape,variant:t.variant,"is-markdown":t.isMarkdown,"is-fog":t.isFog,typing:t.typing,"max-width":t.maxWidth,avatar:t.avatar,"avatar-size":t.avatarSize,"avatar-gap":t.avatarGap,"avatar-shape":t.avatarShape,"avatar-src-set":t.avatarSrcSet,"avatar-alt":t.avatarAlt,"avatar-fit":t.avatarFit,"no-style":t.noStyle,class:e.normalizeClass({[`is-${t.role}`]:!0})},e.createSlots({_:2},[o.$slots.avatar?{name:"avatar",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"avatar",{item:t})]),key:"0"}:void 0,o.$slots.header?{name:"header",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"header",{item:t})]),key:"1"}:void 0,o.$slots.content?{name:"content",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"content",{item:t})]),key:"2"}:void 0,o.$slots.footer?{name:"footer",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"footer",{item:t})]),key:"3"}:void 0,o.$slots.loading?{name:"loading",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"loading",{item:t})]),key:"4"}:void 0]),1032,["content","placement","loading","shape","variant","is-markdown","is-fog","typing","max-width","avatar","avatar-size","avatar-gap","avatar-shape","avatar-src-set","avatar-alt","avatar-fit","no-style","class"]))),128))]),_:3},8,["append-to","always"])),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(["vk-bubble-list-default-back-button",{"vk-bubble-list-back-to-bottom-solt":o.$slots.backToBottom}]),style:e.normalizeStyle({bottom:l.backButtonPosition.bottom,left:l.backButtonPosition.left}),onClick:h},[e.renderSlot(o.$slots,"backToBottom",{},()=>[e.createVNode(b,{class:"vk-bubble-list-back-to-bottom-icon",style:e.normalizeStyle({color:r.btnColor})},{default:e.withCtx(()=>[e.createVNode(e.unref(R.ArrowDownBold)),r.btnLoading?(e.openBlock(),e.createBlock(A,{key:0,class:"back-to-bottom-loading-svg-bg"})):e.createCommentVNode("",!0)]),_:1},8,["style"])])],6),[[e.vShow,S.value]])])}}}),L={items:{type:Array,default:()=>[]},elRef:{type:Function,default:z.noop},scrollbarAppendTo:null,virtual:{type:Boolean,default:!1},keyField:{type:String,default:"key"},autoScrollThreshold:{type:Number,default:200}},f=e.defineComponent({name:"VkBubbleList",inheritAttrs:!1,__name:"index",props:L,setup(l,{expose:i}){const r=l,n=e.ref();return e.watch(()=>r.elRef,a=>{a&&a(n.value)},{immediate:!0}),i({scrollToTop:()=>n.value?.scrollToTop(),scrollToBottom:()=>n.value?.scrollToBottom(),scrollToBubble:a=>n.value?.scrollToBubble(a)}),(a,v)=>(e.openBlock(),e.createBlock(e.unref(m.VkBubbleRenderTemplates),null,{placeholder:e.withCtx(()=>[e.createVNode(e.unref(m.VkBubbleTemplates))]),default:e.withCtx(()=>[e.renderSlot(a.$slots,"renderer"),e.createVNode(e.unref($.ElAutoResizer),null,{default:e.withCtx(({height:u})=>[e.createVNode(I,e.mergeProps({ref_key:"bubbleListRef",ref:n,"btn-icon-size":18,"max-height":`${u}px`,"scrollbar-append-to":a.scrollbarAppendTo,virtual:a.virtual,"key-field":a.keyField,"auto-scroll-threshold":a.autoScrollThreshold,style:{"--el-bubble-list-max-height":`${u}px`},list:a.items},a.$attrs),e.createSlots({content:e.withCtx(({item:s})=>[e.createVNode(e.unref(m.VkBubbleRenderer),{source:[s]},null,8,["source"])]),_:2},[a.$slots.avatar?{name:"avatar",fn:e.withCtx(s=>[e.renderSlot(a.$slots,"avatar",e.normalizeProps(e.guardReactiveProps(s)))]),key:"0"}:void 0,a.$slots.header?{name:"header",fn:e.withCtx(s=>[e.renderSlot(a.$slots,"header",e.normalizeProps(e.guardReactiveProps(s)))]),key:"1"}:void 0,a.$slots.loading?{name:"loading",fn:e.withCtx(s=>[e.renderSlot(a.$slots,"loading",e.normalizeProps(e.guardReactiveProps(s)))]),key:"2"}:void 0,a.$slots.footer?{name:"footer",fn:e.withCtx(s=>[e.renderSlot(a.$slots,"footer",e.normalizeProps(e.guardReactiveProps(s)))]),key:"3"}:void 0]),1040,["max-height","scrollbar-append-to","virtual","key-field","auto-scroll-threshold","style","list"])]),_:3})]),_:3}))}}),M=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));f.install=l=>{l.component(f.name||"VkBubbleList",f)};Object.defineProperty(exports,"Role",{enumerable:!0,get:()=>P.Role});exports.VkBubbleList=f;exports.__VkBubbleList=M;exports.default=f;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),k=require("@vunk/plus/components/bubble-templates"),P=require("element-plus"),B=require("@vunk/plus/vue-virtual-scroller"),F=require("@element-plus/icons-vue"),q=require("@vueuse/core"),S=require("@vunk/plus/components/scrollbar"),C=require("@vunk/plus/element/bubble"),I=require("../_plugin-vue_export-helper-BHFhmbuH.js"),N=require("@vunk/shared/function"),A=require("@vunk/plus/components/agent-chat-provider"),E={},O={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1",width:"704",height:"704",viewBox:"0 0 704 704"};function M(n,f){return e.openBlock(),e.createElementBlock("svg",O,[...f[0]||(f[0]=[e.createStaticVNode('<defs><filter id="master_svg0_62_10054" filterUnits="objectBoundingBox" color-interpolation-filters="sRGB" x="-0.030120481927710843" y="-0.030120481927710843" width="1.0602409638554218" height="1.0602409638554218"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="5" result="effect1_foregroundBlur"></feGaussianBlur></filter><linearGradient id="master_svg1_62_10082" x1="0.5" y1="-0.13192443549633026" x2="0.42319029569625854" y2="1.368432641029358"><stop offset="9.145302325487137%" stop-color="currentColor" stop-opacity="1"></stop><stop offset="13.636428117752075%" stop-color="currentColor" stop-opacity="0.07539999485015869"></stop><stop offset="16.968481242656708%" stop-color="currentColor" stop-opacity="0"></stop></linearGradient></defs><g transform="matrix(0,1,-1,0,704,-664)" filter="url(#master_svg0_62_10054)"><path d="M1016,684C1199.359,684,1348,535.359,1348,352C1348,168.641,1199.359,20,1016,20C832.641,20,684,168.641,684,352C684,535.359,832.641,684,1016,684ZM1016,32C1192.731,32,1336,175.269,1336,352C1336,528.731,1192.731,672,1016,672C839.269,672,696,528.731,696,352C696,175.269,839.269,32,1016,32Z" fill-rule="evenodd" fill="url(#master_svg1_62_10082)" fill-opacity="1"></path></g>',2)])])}const H=I._export_sfc(E,[["render",M]]),L={class:"vk-bubble-list-wrapper"},G=e.defineComponent({__name:"index",props:{list:{type:Array,default:()=>[]},autoScroll:{type:Boolean,default:!0},autoScrollThreshold:{type:Number,default:200},maxHeight:{type:String,default:""},alwaysShowScrollbar:{type:Boolean,default:!1},backButtonThreshold:{type:Number,default:80},showBackButton:{type:Boolean,default:!0},backButtonPosition:{type:Object,default:()=>({bottom:"20px",left:"calc(50% - 19px)"})},btnLoading:{type:Boolean,default:!0},btnColor:{type:String,default:"#409EFF"},btnIconSize:{type:Number,default:24},scrollbarAppendTo:{type:null,default:void 0},virtual:{type:Boolean,default:!1},keyField:{type:String,default:"key"}},emits:{complete:null},setup(n,{expose:f}){const s=n,r=e.ref(),a=e.ref(),h=e.ref();function b(){document.documentElement.style.setProperty("--el-bubble-list-max-height",s.maxHeight||"100%"),document.documentElement.style.setProperty("--el-bubble-list-btn-size",`${s.btnIconSize}px`)}e.onMounted(()=>{b(),s.virtual&&e.nextTick(()=>{const o=r.value?.wrapRef;o&&(h.value=o)}),setTimeout(g)}),e.watch(()=>[s.maxHeight,s.btnIconSize],()=>b());const i=e.ref(),T=e.computed(()=>s.showBackButton&&i.value!==void 0&&i.value>s.backButtonThreshold);let p=!1;function g(){const o=r.value?.wrapRef;if(o)return i.value=o.scrollHeight-o.scrollTop-o.clientHeight,i.value}function y(){if(s.virtual){a.value?.scrollToBottom();return}r.value?.scrollToBottom()}function $(){if(s.virtual){a.value?.scrollToItem(0);return}r.value?.scrollToTop()}async function R(o){if(s.virtual){const l=r.value?.wrapRef;if(!l)return;p=!0;try{const d=l.querySelector(`[data-index="${o}"][data-visible="true"] .el-bubble`);if(d){const u=l.getBoundingClientRect(),c=d.getBoundingClientRect();l.scrollTo({top:c.top-u.top+l.scrollTop-24,behavior:"auto"});return}let t=0;for(;t<o;){const u=a.value?.getItemOffset(t+1)??0;l.scrollTo({top:u,behavior:"auto"}),await new Promise(c=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>c())})}),t=Math.min(t+20,o)}for(const u of[1,2]){a.value?.scrollToItem(o),await new Promise(m=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>m())})});const c=l.querySelector(`[data-index="${o}"][data-visible="true"] .el-bubble`);if(c){const m=l.getBoundingClientRect(),z=c.getBoundingClientRect();l.scrollTo({top:z.top-m.top+l.scrollTop-24,behavior:"auto"})}}}finally{p=!1}return}p=!0;try{const l=r.value?.wrapRef;if(!l)return;const d=l.querySelectorAll(".el-bubble");if(o>=d.length)return;const t=d[o],u=l.getBoundingClientRect(),c=t.getBoundingClientRect();l.scrollTo({top:c.top-u.top+l.scrollTop,behavior:"smooth"})}finally{p=!1}}function V(o){return a.value?.getItemOffset(o)}function x(){const o=a.value,l=r.value?.wrapRef;if(!o||!l)return;const d=l.scrollTop,t=l.clientHeight,u=o.findItemIndex(d),c=o.findItemIndex(d+t);return{start:u,end:c}}const w=e.ref();return e.onMounted(()=>{e.nextTick(()=>{w.value=r.value?.wrapRef?.firstElementChild})}),s.autoScroll&&q.useResizeObserver(w,()=>{if(p)return;const o=g();o!==void 0&&o>s.autoScrollThreshold||y()}),f({scrollToTop:$,scrollToBottom:y,scrollToBubble:R,getItemOffset:V,getVisibleRange:x}),(o,l)=>{const d=e.resolveComponent("el-icon");return e.openBlock(),e.createElementBlock("div",L,[n.virtual?(e.openBlock(),e.createElementBlock("div",{key:0,class:"vk-bubble-list-virtual-host",style:e.normalizeStyle({height:n.maxHeight||"100%"})},[e.createVNode(e.unref(S.VkScrollbar),{ref_key:"scrollbarRef",ref:r,class:"vk-bubble-list-virtual-scrollbar",always:n.alwaysShowScrollbar,"hide-after":800,onScroll:g},{default:e.withCtx(()=>[h.value?(e.openBlock(),e.createBlock(e.unref(B.DynamicScroller),{key:0,ref_key:"scrollerRef",ref:a,items:n.list,"min-item-size":54,"key-field":n.keyField,"page-mode":!0,"scroll-parent":h.value,class:"vk-bubble-list-dynamic-scroller"},{default:e.withCtx(({item:t,index:u,active:c})=>[e.createVNode(e.unref(B.DynamicScrollerItem),{item:t,active:c,"data-index":u,"data-visible":c,class:"vk-bubble-list-virtual-item"},{default:e.withCtx(()=>[e.createVNode(e.unref(C.Bubble),{content:t.content,placement:t.placement,loading:t.loading,shape:t.shape,variant:t.variant,"is-markdown":t.isMarkdown,"is-fog":t.isFog,typing:t.typing,"max-width":t.maxWidth,avatar:t.avatar,"avatar-size":t.avatarSize,"avatar-gap":t.avatarGap,"avatar-shape":t.avatarShape,"avatar-src-set":t.avatarSrcSet,"avatar-alt":t.avatarAlt,"avatar-fit":t.avatarFit,"no-style":t.noStyle,class:e.normalizeClass({[`is-${t.role}`]:!0})},e.createSlots({_:2},[o.$slots.avatar?{name:"avatar",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"avatar",{item:t})]),key:"0"}:void 0,o.$slots.header?{name:"header",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"header",{item:t})]),key:"1"}:void 0,o.$slots.content?{name:"content",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"content",{item:t})]),key:"2"}:void 0,o.$slots.footer?{name:"footer",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"footer",{item:t})]),key:"3"}:void 0,o.$slots.loading?{name:"loading",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"loading",{item:t})]),key:"4"}:void 0]),1032,["content","placement","loading","shape","variant","is-markdown","is-fog","typing","max-width","avatar","avatar-size","avatar-gap","avatar-shape","avatar-src-set","avatar-alt","avatar-fit","no-style","class"])]),_:2},1032,["item","active","data-index","data-visible"])]),_:3},8,["items","key-field","scroll-parent"])):e.createCommentVNode("",!0)]),_:3},8,["always"])],4)):(e.openBlock(),e.createBlock(e.unref(S.VkScrollbar),{key:1,ref_key:"scrollbarRef",ref:r,class:"vk-bubble-list","append-to":n.scrollbarAppendTo,always:n.alwaysShowScrollbar,"hide-after":800,onScroll:g},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.list,(t,u)=>(e.openBlock(),e.createBlock(e.unref(C.Bubble),{key:t.key||u,content:t.content,placement:t.placement,loading:t.loading,shape:t.shape,variant:t.variant,"is-markdown":t.isMarkdown,"is-fog":t.isFog,typing:t.typing,"max-width":t.maxWidth,avatar:t.avatar,"avatar-size":t.avatarSize,"avatar-gap":t.avatarGap,"avatar-shape":t.avatarShape,"avatar-src-set":t.avatarSrcSet,"avatar-alt":t.avatarAlt,"avatar-fit":t.avatarFit,"no-style":t.noStyle,class:e.normalizeClass({[`is-${t.role}`]:!0})},e.createSlots({_:2},[o.$slots.avatar?{name:"avatar",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"avatar",{item:t})]),key:"0"}:void 0,o.$slots.header?{name:"header",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"header",{item:t})]),key:"1"}:void 0,o.$slots.content?{name:"content",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"content",{item:t})]),key:"2"}:void 0,o.$slots.footer?{name:"footer",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"footer",{item:t})]),key:"3"}:void 0,o.$slots.loading?{name:"loading",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"loading",{item:t})]),key:"4"}:void 0]),1032,["content","placement","loading","shape","variant","is-markdown","is-fog","typing","max-width","avatar","avatar-size","avatar-gap","avatar-shape","avatar-src-set","avatar-alt","avatar-fit","no-style","class"]))),128))]),_:3},8,["append-to","always"])),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(["vk-bubble-list-default-back-button",{"vk-bubble-list-back-to-bottom-solt":o.$slots.backToBottom}]),style:e.normalizeStyle({bottom:n.backButtonPosition.bottom,left:n.backButtonPosition.left}),onClick:y},[e.renderSlot(o.$slots,"backToBottom",{},()=>[e.createVNode(d,{class:"vk-bubble-list-back-to-bottom-icon",style:e.normalizeStyle({color:s.btnColor})},{default:e.withCtx(()=>[e.createVNode(e.unref(F.ArrowDownBold)),s.btnLoading?(e.openBlock(),e.createBlock(H,{key:0,class:"back-to-bottom-loading-svg-bg"})):e.createCommentVNode("",!0)]),_:1},8,["style"])])],6),[[e.vShow,T.value]])])}}}),_={items:{type:Array,default:()=>[]},elRef:{type:Function,default:N.noop},scrollbarAppendTo:null,virtual:{type:Boolean,default:!1},keyField:{type:String,default:"key"},autoScrollThreshold:{type:Number,default:200}},v=e.defineComponent({name:"VkBubbleList",inheritAttrs:!1,__name:"index",props:_,setup(n,{expose:f}){const s=n,r=e.ref();return e.watch(()=>s.elRef,a=>{a&&a(r.value)},{immediate:!0}),f({scrollToTop:()=>r.value?.scrollToTop(),scrollToBottom:()=>r.value?.scrollToBottom(),scrollToBubble:a=>r.value?.scrollToBubble(a),getItemOffset:a=>r.value?.getItemOffset(a),getVisibleRange:()=>r.value?.getVisibleRange()}),(a,h)=>(e.openBlock(),e.createBlock(e.unref(k.VkBubbleRenderTemplates),null,{placeholder:e.withCtx(()=>[e.createVNode(e.unref(k.VkBubbleTemplates))]),default:e.withCtx(()=>[e.renderSlot(a.$slots,"renderer"),e.createVNode(e.unref(P.ElAutoResizer),null,{default:e.withCtx(({height:b})=>[e.createVNode(G,e.mergeProps({ref_key:"bubbleListRef",ref:r,"btn-icon-size":18,"max-height":`${b}px`,"scrollbar-append-to":a.scrollbarAppendTo,virtual:a.virtual,"key-field":a.keyField,"auto-scroll-threshold":a.autoScrollThreshold,style:{"--el-bubble-list-max-height":`${b}px`},list:a.items},a.$attrs),e.createSlots({content:e.withCtx(({item:i})=>[e.createVNode(e.unref(k.VkBubbleRenderer),{source:[i]},null,8,["source"])]),_:2},[a.$slots.avatar?{name:"avatar",fn:e.withCtx(i=>[e.renderSlot(a.$slots,"avatar",e.normalizeProps(e.guardReactiveProps(i)))]),key:"0"}:void 0,a.$slots.header?{name:"header",fn:e.withCtx(i=>[e.renderSlot(a.$slots,"header",e.normalizeProps(e.guardReactiveProps(i)))]),key:"1"}:void 0,a.$slots.loading?{name:"loading",fn:e.withCtx(i=>[e.renderSlot(a.$slots,"loading",e.normalizeProps(e.guardReactiveProps(i)))]),key:"2"}:void 0,a.$slots.footer?{name:"footer",fn:e.withCtx(i=>[e.renderSlot(a.$slots,"footer",e.normalizeProps(e.guardReactiveProps(i)))]),key:"3"}:void 0]),1040,["max-height","scrollbar-append-to","virtual","key-field","auto-scroll-threshold","style","list"])]),_:3})]),_:3}))}}),j=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));v.install=n=>{n.component(v.name||"VkBubbleList",v)};Object.defineProperty(exports,"Role",{enumerable:!0,get:()=>A.Role});exports.VkBubbleList=v;exports.__VkBubbleList=j;exports.default=v;
@@ -1,15 +1,15 @@
1
- import { openBlock as c, createElementBlock as S, createStaticVNode as x, defineComponent as G, ref as p, onMounted as V, nextTick as P, watch as N, computed as j, resolveComponent as O, normalizeStyle as R, createVNode as d, unref as u, withCtx as o, createBlock as y, normalizeClass as C, createSlots as F, renderSlot as s, createCommentVNode as I, Fragment as q, renderList as W, withDirectives as Z, createElementVNode as _, vShow as U, mergeProps as J, normalizeProps as B, guardReactiveProps as w } from "vue";
2
- import { VkBubbleRenderTemplates as K, VkBubbleRenderer as Q, VkBubbleTemplates as X } from "@vunk/plus/components/bubble-templates";
3
- import { ElAutoResizer as Y } from "element-plus";
4
- import { DynamicScroller as ee, DynamicScrollerItem as te } from "@vunk/plus/vue-virtual-scroller";
5
- import { ArrowDownBold as ae } from "@element-plus/icons-vue";
6
- import { useResizeObserver as oe } from "@vueuse/core";
7
- import { VkScrollbar as L } from "@vunk/plus/components/scrollbar";
8
- import { Bubble as E } from "@vunk/plus/element/bubble";
9
- import { _ as le } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
10
- import { noop as re } from "@vunk/shared/function";
11
- import { Role as Re } from "@vunk/plus/components/agent-chat-provider";
12
- const se = {}, ne = {
1
+ import { openBlock as v, createElementBlock as $, createStaticVNode as W, defineComponent as H, ref as y, onMounted as P, nextTick as E, watch as N, computed as Z, resolveComponent as U, normalizeStyle as F, createVNode as b, unref as f, withCtx as o, createBlock as k, normalizeClass as z, createSlots as V, renderSlot as i, createCommentVNode as L, Fragment as J, renderList as K, withDirectives as Q, createElementVNode as X, vShow as Y, mergeProps as ee, normalizeProps as S, guardReactiveProps as T } from "vue";
2
+ import { VkBubbleRenderTemplates as te, VkBubbleRenderer as ae, VkBubbleTemplates as oe } from "@vunk/plus/components/bubble-templates";
3
+ import { ElAutoResizer as le } from "element-plus";
4
+ import { DynamicScroller as re, DynamicScrollerItem as se } from "@vunk/plus/vue-virtual-scroller";
5
+ import { ArrowDownBold as ne } from "@element-plus/icons-vue";
6
+ import { useResizeObserver as ie } from "@vueuse/core";
7
+ import { VkScrollbar as O } from "@vunk/plus/components/scrollbar";
8
+ import { Bubble as G } from "@vunk/plus/element/bubble";
9
+ import { _ as ue } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
10
+ import { noop as ce } from "@vunk/shared/function";
11
+ import { Role as Ve } from "@vunk/plus/components/agent-chat-provider";
12
+ const de = {}, fe = {
13
13
  xmlns: "http://www.w3.org/2000/svg",
14
14
  "xmlns:xlink": "http://www.w3.org/1999/xlink",
15
15
  version: "1.1",
@@ -17,12 +17,12 @@ const se = {}, ne = {
17
17
  height: "704",
18
18
  viewBox: "0 0 704 704"
19
19
  };
20
- function ie(l, f) {
21
- return c(), S("svg", ne, [...f[0] || (f[0] = [
22
- x('<defs><filter id="master_svg0_62_10054" filterUnits="objectBoundingBox" color-interpolation-filters="sRGB" x="-0.030120481927710843" y="-0.030120481927710843" width="1.0602409638554218" height="1.0602409638554218"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="5" result="effect1_foregroundBlur"></feGaussianBlur></filter><linearGradient id="master_svg1_62_10082" x1="0.5" y1="-0.13192443549633026" x2="0.42319029569625854" y2="1.368432641029358"><stop offset="9.145302325487137%" stop-color="currentColor" stop-opacity="1"></stop><stop offset="13.636428117752075%" stop-color="currentColor" stop-opacity="0.07539999485015869"></stop><stop offset="16.968481242656708%" stop-color="currentColor" stop-opacity="0"></stop></linearGradient></defs><g transform="matrix(0,1,-1,0,704,-664)" filter="url(#master_svg0_62_10054)"><path d="M1016,684C1199.359,684,1348,535.359,1348,352C1348,168.641,1199.359,20,1016,20C832.641,20,684,168.641,684,352C684,535.359,832.641,684,1016,684ZM1016,32C1192.731,32,1336,175.269,1336,352C1336,528.731,1192.731,672,1016,672C839.269,672,696,528.731,696,352C696,175.269,839.269,32,1016,32Z" fill-rule="evenodd" fill="url(#master_svg1_62_10082)" fill-opacity="1"></path></g>', 2)
20
+ function pe(s, m) {
21
+ return v(), $("svg", fe, [...m[0] || (m[0] = [
22
+ W('<defs><filter id="master_svg0_62_10054" filterUnits="objectBoundingBox" color-interpolation-filters="sRGB" x="-0.030120481927710843" y="-0.030120481927710843" width="1.0602409638554218" height="1.0602409638554218"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="5" result="effect1_foregroundBlur"></feGaussianBlur></filter><linearGradient id="master_svg1_62_10082" x1="0.5" y1="-0.13192443549633026" x2="0.42319029569625854" y2="1.368432641029358"><stop offset="9.145302325487137%" stop-color="currentColor" stop-opacity="1"></stop><stop offset="13.636428117752075%" stop-color="currentColor" stop-opacity="0.07539999485015869"></stop><stop offset="16.968481242656708%" stop-color="currentColor" stop-opacity="0"></stop></linearGradient></defs><g transform="matrix(0,1,-1,0,704,-664)" filter="url(#master_svg0_62_10054)"><path d="M1016,684C1199.359,684,1348,535.359,1348,352C1348,168.641,1199.359,20,1016,20C832.641,20,684,168.641,684,352C684,535.359,832.641,684,1016,684ZM1016,32C1192.731,32,1336,175.269,1336,352C1336,528.731,1192.731,672,1016,672C839.269,672,696,528.731,696,352C696,175.269,839.269,32,1016,32Z" fill-rule="evenodd" fill="url(#master_svg1_62_10082)" fill-opacity="1"></path></g>', 2)
23
23
  ])]);
24
24
  }
25
- const ue = /* @__PURE__ */ le(se, [["render", ie]]), ce = { class: "vk-bubble-list-wrapper" }, de = /* @__PURE__ */ G({
25
+ const ve = /* @__PURE__ */ ue(de, [["render", pe]]), be = { class: "vk-bubble-list-wrapper" }, me = /* @__PURE__ */ H({
26
26
  __name: "index",
27
27
  props: {
28
28
  list: {
@@ -90,114 +90,172 @@ const ue = /* @__PURE__ */ le(se, [["render", ie]]), ce = { class: "vk-bubble-li
90
90
  emits: {
91
91
  complete: null
92
92
  },
93
- setup(l, { expose: f }) {
94
- const r = l, n = p(), a = p(), h = p();
95
- function b() {
93
+ setup(s, { expose: m }) {
94
+ const n = s, r = y(), a = y(), w = y();
95
+ function g() {
96
96
  document.documentElement.style.setProperty(
97
97
  "--el-bubble-list-max-height",
98
- r.maxHeight || "100%"
98
+ n.maxHeight || "100%"
99
99
  ), document.documentElement.style.setProperty(
100
100
  "--el-bubble-list-btn-size",
101
- `${r.btnIconSize}px`
101
+ `${n.btnIconSize}px`
102
102
  );
103
103
  }
104
- V(() => {
105
- b(), r.virtual && P(() => {
106
- const t = n.value?.wrapRef;
107
- t && (h.value = t);
108
- }), setTimeout(g);
104
+ P(() => {
105
+ g(), n.virtual && E(() => {
106
+ const t = r.value?.wrapRef;
107
+ t && (w.value = t);
108
+ }), setTimeout(B);
109
109
  }), N(
110
- () => [r.maxHeight, r.btnIconSize],
111
- () => b()
110
+ () => [n.maxHeight, n.btnIconSize],
111
+ () => g()
112
112
  );
113
- const i = p(), D = j(() => r.showBackButton && i.value !== void 0 && i.value > r.backButtonThreshold);
114
- function g() {
115
- const t = n.value?.wrapRef;
113
+ const u = y(), q = Z(() => n.showBackButton && u.value !== void 0 && u.value > n.backButtonThreshold);
114
+ let h = !1;
115
+ function B() {
116
+ const t = r.value?.wrapRef;
116
117
  if (t)
117
- return i.value = t.scrollHeight - t.scrollTop - t.clientHeight, i.value;
118
+ return u.value = t.scrollHeight - t.scrollTop - t.clientHeight, u.value;
118
119
  }
119
- function T() {
120
- if (r.virtual) {
120
+ function R() {
121
+ if (n.virtual) {
121
122
  a.value?.scrollToBottom();
122
123
  return;
123
124
  }
124
- n.value?.scrollToBottom();
125
+ r.value?.scrollToBottom();
125
126
  }
126
- function H() {
127
- if (r.virtual) {
127
+ function M() {
128
+ if (n.virtual) {
128
129
  a.value?.scrollToItem(0);
129
130
  return;
130
131
  }
131
- n.value?.scrollToTop();
132
+ r.value?.scrollToTop();
132
133
  }
133
- function M(t) {
134
- if (r.virtual) {
135
- a.value?.scrollToItem(t), requestAnimationFrame(() => {
136
- requestAnimationFrame(() => {
137
- a.value?.scrollToItem(t);
138
- });
139
- });
134
+ async function x(t) {
135
+ if (n.virtual) {
136
+ const l = r.value?.wrapRef;
137
+ if (!l) return;
138
+ h = !0;
139
+ try {
140
+ const p = l.querySelector(
141
+ `[data-index="${t}"][data-visible="true"] .el-bubble`
142
+ );
143
+ if (p) {
144
+ const d = l.getBoundingClientRect(), c = p.getBoundingClientRect();
145
+ l.scrollTo({
146
+ top: c.top - d.top + l.scrollTop - 24,
147
+ behavior: "auto"
148
+ });
149
+ return;
150
+ }
151
+ let e = 0;
152
+ for (; e < t; ) {
153
+ const d = a.value?.getItemOffset(e + 1) ?? 0;
154
+ l.scrollTo({ top: d, behavior: "auto" }), await new Promise((c) => {
155
+ requestAnimationFrame(() => {
156
+ requestAnimationFrame(() => c());
157
+ });
158
+ }), e = Math.min(e + 20, t);
159
+ }
160
+ for (const d of [1, 2]) {
161
+ a.value?.scrollToItem(t), await new Promise((C) => {
162
+ requestAnimationFrame(() => {
163
+ requestAnimationFrame(() => C());
164
+ });
165
+ });
166
+ const c = l.querySelector(
167
+ `[data-index="${t}"][data-visible="true"] .el-bubble`
168
+ );
169
+ if (c) {
170
+ const C = l.getBoundingClientRect(), _ = c.getBoundingClientRect();
171
+ l.scrollTo({
172
+ top: _.top - C.top + l.scrollTop - 24,
173
+ behavior: "auto"
174
+ });
175
+ }
176
+ }
177
+ } finally {
178
+ h = !1;
179
+ }
140
180
  return;
141
181
  }
142
- const v = n.value?.wrapRef;
143
- if (!v) return;
144
- const k = v.querySelectorAll(".el-bubble");
145
- if (t >= k.length) return;
146
- const e = k[t], m = v.getBoundingClientRect(), $ = e.getBoundingClientRect();
147
- v.scrollTo({
148
- top: $.top - m.top + v.scrollTop,
149
- behavior: "smooth"
150
- });
182
+ h = !0;
183
+ try {
184
+ const l = r.value?.wrapRef;
185
+ if (!l) return;
186
+ const p = l.querySelectorAll(".el-bubble");
187
+ if (t >= p.length) return;
188
+ const e = p[t], d = l.getBoundingClientRect(), c = e.getBoundingClientRect();
189
+ l.scrollTo({
190
+ top: c.top - d.top + l.scrollTop,
191
+ behavior: "smooth"
192
+ });
193
+ } finally {
194
+ h = !1;
195
+ }
196
+ }
197
+ function D(t) {
198
+ return a.value?.getItemOffset(t);
199
+ }
200
+ function j() {
201
+ const t = a.value, l = r.value?.wrapRef;
202
+ if (!t || !l) return;
203
+ const p = l.scrollTop, e = l.clientHeight, d = t.findItemIndex(p), c = t.findItemIndex(p + e);
204
+ return { start: d, end: c };
151
205
  }
152
- const A = p();
153
- return V(() => {
154
- P(() => {
155
- A.value = n.value?.wrapRef?.firstElementChild;
206
+ const A = y();
207
+ return P(() => {
208
+ E(() => {
209
+ A.value = r.value?.wrapRef?.firstElementChild;
156
210
  });
157
- }), r.autoScroll && oe(A, () => {
158
- const t = g();
159
- t !== void 0 && t > r.autoScrollThreshold || T();
160
- }), f({
161
- scrollToTop: H,
162
- scrollToBottom: T,
163
- scrollToBubble: M
164
- }), (t, v) => {
165
- const k = O("el-icon");
166
- return c(), S("div", ce, [
167
- l.virtual ? (c(), S("div", {
211
+ }), n.autoScroll && ie(A, () => {
212
+ if (h) return;
213
+ const t = B();
214
+ t !== void 0 && t > n.autoScrollThreshold || R();
215
+ }), m({
216
+ scrollToTop: M,
217
+ scrollToBottom: R,
218
+ scrollToBubble: x,
219
+ getItemOffset: D,
220
+ getVisibleRange: j
221
+ }), (t, l) => {
222
+ const p = U("el-icon");
223
+ return v(), $("div", be, [
224
+ s.virtual ? (v(), $("div", {
168
225
  key: 0,
169
226
  class: "vk-bubble-list-virtual-host",
170
- style: R({ height: l.maxHeight || "100%" })
227
+ style: F({ height: s.maxHeight || "100%" })
171
228
  }, [
172
- d(u(L), {
229
+ b(f(O), {
173
230
  ref_key: "scrollbarRef",
174
- ref: n,
231
+ ref: r,
175
232
  class: "vk-bubble-list-virtual-scrollbar",
176
- always: l.alwaysShowScrollbar,
233
+ always: s.alwaysShowScrollbar,
177
234
  "hide-after": 800,
178
- onScroll: g
235
+ onScroll: B
179
236
  }, {
180
237
  default: o(() => [
181
- h.value ? (c(), y(u(ee), {
238
+ w.value ? (v(), k(f(re), {
182
239
  key: 0,
183
240
  ref_key: "scrollerRef",
184
241
  ref: a,
185
- items: l.list,
242
+ items: s.list,
186
243
  "min-item-size": 54,
187
- "key-field": l.keyField,
244
+ "key-field": s.keyField,
188
245
  "page-mode": !0,
189
- "scroll-parent": h.value,
246
+ "scroll-parent": w.value,
190
247
  class: "vk-bubble-list-dynamic-scroller"
191
248
  }, {
192
- default: o(({ item: e, index: m, active: $ }) => [
193
- d(u(te), {
249
+ default: o(({ item: e, index: d, active: c }) => [
250
+ b(f(se), {
194
251
  item: e,
195
- active: $,
196
- "data-index": m,
252
+ active: c,
253
+ "data-index": d,
254
+ "data-visible": c,
197
255
  class: "vk-bubble-list-virtual-item"
198
256
  }, {
199
257
  default: o(() => [
200
- d(u(E), {
258
+ b(f(G), {
201
259
  content: e.content,
202
260
  placement: e.placement,
203
261
  loading: e.loading,
@@ -215,68 +273,68 @@ const ue = /* @__PURE__ */ le(se, [["render", ie]]), ce = { class: "vk-bubble-li
215
273
  "avatar-alt": e.avatarAlt,
216
274
  "avatar-fit": e.avatarFit,
217
275
  "no-style": e.noStyle,
218
- class: C({
276
+ class: z({
219
277
  [`is-${e.role}`]: !0
220
278
  })
221
- }, F({ _: 2 }, [
279
+ }, V({ _: 2 }, [
222
280
  t.$slots.avatar ? {
223
281
  name: "avatar",
224
282
  fn: o(() => [
225
- s(t.$slots, "avatar", { item: e })
283
+ i(t.$slots, "avatar", { item: e })
226
284
  ]),
227
285
  key: "0"
228
286
  } : void 0,
229
287
  t.$slots.header ? {
230
288
  name: "header",
231
289
  fn: o(() => [
232
- s(t.$slots, "header", { item: e })
290
+ i(t.$slots, "header", { item: e })
233
291
  ]),
234
292
  key: "1"
235
293
  } : void 0,
236
294
  t.$slots.content ? {
237
295
  name: "content",
238
296
  fn: o(() => [
239
- s(t.$slots, "content", { item: e })
297
+ i(t.$slots, "content", { item: e })
240
298
  ]),
241
299
  key: "2"
242
300
  } : void 0,
243
301
  t.$slots.footer ? {
244
302
  name: "footer",
245
303
  fn: o(() => [
246
- s(t.$slots, "footer", { item: e })
304
+ i(t.$slots, "footer", { item: e })
247
305
  ]),
248
306
  key: "3"
249
307
  } : void 0,
250
308
  t.$slots.loading ? {
251
309
  name: "loading",
252
310
  fn: o(() => [
253
- s(t.$slots, "loading", { item: e })
311
+ i(t.$slots, "loading", { item: e })
254
312
  ]),
255
313
  key: "4"
256
314
  } : void 0
257
315
  ]), 1032, ["content", "placement", "loading", "shape", "variant", "is-markdown", "is-fog", "typing", "max-width", "avatar", "avatar-size", "avatar-gap", "avatar-shape", "avatar-src-set", "avatar-alt", "avatar-fit", "no-style", "class"])
258
316
  ]),
259
317
  _: 2
260
- }, 1032, ["item", "active", "data-index"])
318
+ }, 1032, ["item", "active", "data-index", "data-visible"])
261
319
  ]),
262
320
  _: 3
263
- }, 8, ["items", "key-field", "scroll-parent"])) : I("", !0)
321
+ }, 8, ["items", "key-field", "scroll-parent"])) : L("", !0)
264
322
  ]),
265
323
  _: 3
266
324
  }, 8, ["always"])
267
- ], 4)) : (c(), y(u(L), {
325
+ ], 4)) : (v(), k(f(O), {
268
326
  key: 1,
269
327
  ref_key: "scrollbarRef",
270
- ref: n,
328
+ ref: r,
271
329
  class: "vk-bubble-list",
272
- "append-to": l.scrollbarAppendTo,
273
- always: l.alwaysShowScrollbar,
330
+ "append-to": s.scrollbarAppendTo,
331
+ always: s.alwaysShowScrollbar,
274
332
  "hide-after": 800,
275
- onScroll: g
333
+ onScroll: B
276
334
  }, {
277
335
  default: o(() => [
278
- (c(!0), S(q, null, W(l.list, (e, m) => (c(), y(u(E), {
279
- key: e.key || m,
336
+ (v(!0), $(J, null, K(s.list, (e, d) => (v(), k(f(G), {
337
+ key: e.key || d,
280
338
  content: e.content,
281
339
  placement: e.placement,
282
340
  loading: e.loading,
@@ -294,42 +352,42 @@ const ue = /* @__PURE__ */ le(se, [["render", ie]]), ce = { class: "vk-bubble-li
294
352
  "avatar-alt": e.avatarAlt,
295
353
  "avatar-fit": e.avatarFit,
296
354
  "no-style": e.noStyle,
297
- class: C({
355
+ class: z({
298
356
  [`is-${e.role}`]: !0
299
357
  })
300
- }, F({ _: 2 }, [
358
+ }, V({ _: 2 }, [
301
359
  t.$slots.avatar ? {
302
360
  name: "avatar",
303
361
  fn: o(() => [
304
- s(t.$slots, "avatar", { item: e })
362
+ i(t.$slots, "avatar", { item: e })
305
363
  ]),
306
364
  key: "0"
307
365
  } : void 0,
308
366
  t.$slots.header ? {
309
367
  name: "header",
310
368
  fn: o(() => [
311
- s(t.$slots, "header", { item: e })
369
+ i(t.$slots, "header", { item: e })
312
370
  ]),
313
371
  key: "1"
314
372
  } : void 0,
315
373
  t.$slots.content ? {
316
374
  name: "content",
317
375
  fn: o(() => [
318
- s(t.$slots, "content", { item: e })
376
+ i(t.$slots, "content", { item: e })
319
377
  ]),
320
378
  key: "2"
321
379
  } : void 0,
322
380
  t.$slots.footer ? {
323
381
  name: "footer",
324
382
  fn: o(() => [
325
- s(t.$slots, "footer", { item: e })
383
+ i(t.$slots, "footer", { item: e })
326
384
  ]),
327
385
  key: "3"
328
386
  } : void 0,
329
387
  t.$slots.loading ? {
330
388
  name: "loading",
331
389
  fn: o(() => [
332
- s(t.$slots, "loading", { item: e })
390
+ i(t.$slots, "loading", { item: e })
333
391
  ]),
334
392
  key: "4"
335
393
  } : void 0
@@ -337,45 +395,45 @@ const ue = /* @__PURE__ */ le(se, [["render", ie]]), ce = { class: "vk-bubble-li
337
395
  ]),
338
396
  _: 3
339
397
  }, 8, ["append-to", "always"])),
340
- Z(_("div", {
341
- class: C(["vk-bubble-list-default-back-button", {
398
+ Q(X("div", {
399
+ class: z(["vk-bubble-list-default-back-button", {
342
400
  "vk-bubble-list-back-to-bottom-solt": t.$slots.backToBottom
343
401
  }]),
344
- style: R({
345
- bottom: l.backButtonPosition.bottom,
346
- left: l.backButtonPosition.left
402
+ style: F({
403
+ bottom: s.backButtonPosition.bottom,
404
+ left: s.backButtonPosition.left
347
405
  }),
348
- onClick: T
406
+ onClick: R
349
407
  }, [
350
- s(t.$slots, "backToBottom", {}, () => [
351
- d(k, {
408
+ i(t.$slots, "backToBottom", {}, () => [
409
+ b(p, {
352
410
  class: "vk-bubble-list-back-to-bottom-icon",
353
- style: R({ color: r.btnColor })
411
+ style: F({ color: n.btnColor })
354
412
  }, {
355
413
  default: o(() => [
356
- d(u(ae)),
357
- r.btnLoading ? (c(), y(ue, {
414
+ b(f(ne)),
415
+ n.btnLoading ? (v(), k(ve, {
358
416
  key: 0,
359
417
  class: "back-to-bottom-loading-svg-bg"
360
- })) : I("", !0)
418
+ })) : L("", !0)
361
419
  ]),
362
420
  _: 1
363
421
  }, 8, ["style"])
364
422
  ])
365
423
  ], 6), [
366
- [U, D.value]
424
+ [Y, q.value]
367
425
  ])
368
426
  ]);
369
427
  };
370
428
  }
371
- }), fe = {
429
+ }), ye = {
372
430
  items: {
373
431
  type: Array,
374
432
  default: () => []
375
433
  },
376
434
  elRef: {
377
435
  type: Function,
378
- default: re
436
+ default: ce
379
437
  },
380
438
  scrollbarAppendTo: null,
381
439
  virtual: {
@@ -394,73 +452,75 @@ const ue = /* @__PURE__ */ le(se, [["render", ie]]), ce = { class: "vk-bubble-li
394
452
  type: Number,
395
453
  default: 200
396
454
  }
397
- }, z = /* @__PURE__ */ G({
455
+ }, I = /* @__PURE__ */ H({
398
456
  name: "VkBubbleList",
399
457
  inheritAttrs: !1,
400
458
  __name: "index",
401
- props: fe,
402
- setup(l, { expose: f }) {
403
- const r = l, n = p();
404
- return N(() => r.elRef, (a) => {
405
- a && a(n.value);
406
- }, { immediate: !0 }), f({
407
- scrollToTop: () => n.value?.scrollToTop(),
408
- scrollToBottom: () => n.value?.scrollToBottom(),
409
- scrollToBubble: (a) => n.value?.scrollToBubble(a)
410
- }), (a, h) => (c(), y(u(K), null, {
459
+ props: ye,
460
+ setup(s, { expose: m }) {
461
+ const n = s, r = y();
462
+ return N(() => n.elRef, (a) => {
463
+ a && a(r.value);
464
+ }, { immediate: !0 }), m({
465
+ scrollToTop: () => r.value?.scrollToTop(),
466
+ scrollToBottom: () => r.value?.scrollToBottom(),
467
+ scrollToBubble: (a) => r.value?.scrollToBubble(a),
468
+ getItemOffset: (a) => r.value?.getItemOffset(a),
469
+ getVisibleRange: () => r.value?.getVisibleRange()
470
+ }), (a, w) => (v(), k(f(te), null, {
411
471
  placeholder: o(() => [
412
- d(u(X))
472
+ b(f(oe))
413
473
  ]),
414
474
  default: o(() => [
415
- s(a.$slots, "renderer"),
416
- d(u(Y), null, {
417
- default: o(({ height: b }) => [
418
- d(de, J({
475
+ i(a.$slots, "renderer"),
476
+ b(f(le), null, {
477
+ default: o(({ height: g }) => [
478
+ b(me, ee({
419
479
  ref_key: "bubbleListRef",
420
- ref: n,
480
+ ref: r,
421
481
  "btn-icon-size": 18,
422
- "max-height": `${b}px`,
482
+ "max-height": `${g}px`,
423
483
  "scrollbar-append-to": a.scrollbarAppendTo,
424
484
  virtual: a.virtual,
425
485
  "key-field": a.keyField,
426
486
  "auto-scroll-threshold": a.autoScrollThreshold,
427
487
  style: {
428
- "--el-bubble-list-max-height": `${b}px`
488
+ "--el-bubble-list-max-height": `${g}px`
429
489
  },
430
490
  list: a.items
431
- }, a.$attrs), F({
432
- content: o(({ item: i }) => [
433
- d(u(Q), {
434
- source: [i]
491
+ }, a.$attrs), V({
492
+ content: o(({ item: u }) => [
493
+ b(f(ae), {
494
+ source: [u]
435
495
  }, null, 8, ["source"])
436
496
  ]),
437
497
  _: 2
438
498
  }, [
439
499
  a.$slots.avatar ? {
440
500
  name: "avatar",
441
- fn: o((i) => [
442
- s(a.$slots, "avatar", B(w(i)))
501
+ fn: o((u) => [
502
+ i(a.$slots, "avatar", S(T(u)))
443
503
  ]),
444
504
  key: "0"
445
505
  } : void 0,
446
506
  a.$slots.header ? {
447
507
  name: "header",
448
- fn: o((i) => [
449
- s(a.$slots, "header", B(w(i)))
508
+ fn: o((u) => [
509
+ i(a.$slots, "header", S(T(u)))
450
510
  ]),
451
511
  key: "1"
452
512
  } : void 0,
453
513
  a.$slots.loading ? {
454
514
  name: "loading",
455
- fn: o((i) => [
456
- s(a.$slots, "loading", B(w(i)))
515
+ fn: o((u) => [
516
+ i(a.$slots, "loading", S(T(u)))
457
517
  ]),
458
518
  key: "2"
459
519
  } : void 0,
460
520
  a.$slots.footer ? {
461
521
  name: "footer",
462
- fn: o((i) => [
463
- s(a.$slots, "footer", B(w(i)))
522
+ fn: o((u) => [
523
+ i(a.$slots, "footer", S(T(u)))
464
524
  ]),
465
525
  key: "3"
466
526
  } : void 0
@@ -472,15 +532,15 @@ const ue = /* @__PURE__ */ le(se, [["render", ie]]), ce = { class: "vk-bubble-li
472
532
  _: 3
473
533
  }));
474
534
  }
475
- }), Se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
535
+ }), Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
476
536
  __proto__: null
477
537
  }, Symbol.toStringTag, { value: "Module" }));
478
- z.install = (l) => {
479
- l.component(z.name || "VkBubbleList", z);
538
+ I.install = (s) => {
539
+ s.component(I.name || "VkBubbleList", I);
480
540
  };
481
541
  export {
482
- Re as Role,
483
- z as VkBubbleList,
484
- Se as __VkBubbleList,
485
- z as default
542
+ Ve as Role,
543
+ I as VkBubbleList,
544
+ Fe as __VkBubbleList,
545
+ I as default
486
546
  };
@@ -2,7 +2,17 @@ import type { __VkAgentChatProvider } from '@vunk/plus/components/agent-chat-pro
2
2
  import type { PropType, TeleportProps } from 'vue';
3
3
  declare function scrollToBottom(): void;
4
4
  declare function scrollToTop(): void;
5
- declare function scrollToBubble(index: number): void;
5
+ declare function scrollToBubble(index: number): Promise<void>;
6
+ /** 获取指定 index 在内容空间中的偏移量(像素),未测量过的 item 返回估算值 */
7
+ declare function getItemOffset(index: number): number | undefined;
8
+ /**
9
+ * 获取当前可见范围(index 区间),用于大纲导航高亮当前项。
10
+ * 基于 findItemIndex + getItemOffset 估算,非实时精确值。
11
+ */
12
+ declare function getVisibleRange(): {
13
+ start: number;
14
+ end: number;
15
+ } | undefined;
6
16
  declare var __VLS_33: {
7
17
  item: __VkAgentChatProvider.BubbleItem;
8
18
  }, __VLS_36: {
@@ -119,6 +129,8 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
119
129
  scrollToTop: typeof scrollToTop;
120
130
  scrollToBottom: typeof scrollToBottom;
121
131
  scrollToBubble: typeof scrollToBubble;
132
+ getItemOffset: typeof getItemOffset;
133
+ getVisibleRange: typeof getVisibleRange;
122
134
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
123
135
  complete: ((...args: unknown[]) => void) & ((...args: any[]) => void);
124
136
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -58,7 +58,12 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
58
58
  }>, {
59
59
  scrollToTop: () => void;
60
60
  scrollToBottom: () => void;
61
- scrollToBubble: (index: number) => void;
61
+ scrollToBubble: (index: number) => Promise<void>;
62
+ getItemOffset: (index: number) => number;
63
+ getVisibleRange: () => {
64
+ start: number;
65
+ end: number;
66
+ };
62
67
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
63
68
  items: {
64
69
  type: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vunk/plus",
3
- "version": "1.16.1",
3
+ "version": "1.16.2",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "ISC",