@king-design/vue 3.7.0 → 3.8.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/__snapshots__/Vue Next Demos.md +399 -0
- package/components/bubble/bubble.d.ts +61 -0
- package/components/bubble/bubble.js +81 -0
- package/components/bubble/bubble.vdt.js +85 -0
- package/components/bubble/index.d.ts +1 -0
- package/components/bubble/index.js +1 -0
- package/components/bubble/index.spec.d.ts +1 -0
- package/components/bubble/index.spec.js +771 -0
- package/components/bubble/styles.d.ts +5 -0
- package/components/bubble/styles.js +53 -0
- package/components/bubble/useBubbleDisplay.d.ts +18 -0
- package/components/bubble/useBubbleDisplay.js +300 -0
- package/components/bubbleList/bubbleList.d.ts +87 -0
- package/components/bubbleList/bubbleList.js +75 -0
- package/components/bubbleList/bubbleList.vdt.js +143 -0
- package/components/bubbleList/index.d.ts +1 -0
- package/components/bubbleList/index.js +1 -0
- package/components/bubbleList/index.spec.d.ts +1 -0
- package/components/bubbleList/index.spec.js +1268 -0
- package/components/bubbleList/item.d.ts +16 -0
- package/components/bubbleList/item.js +27 -0
- package/components/bubbleList/item.vdt.js +36 -0
- package/components/bubbleList/styles.d.ts +5 -0
- package/components/bubbleList/styles.js +33 -0
- package/components/bubbleList/useBubbleList.d.ts +28 -0
- package/components/bubbleList/useBubbleList.js +455 -0
- package/components/checkbox/index.d.ts +3 -3
- package/components/fileCard/fileCard.d.ts +65 -0
- package/components/fileCard/fileCard.js +72 -0
- package/components/fileCard/fileCard.vdt.js +161 -0
- package/components/fileCard/fileCardAssets.d.ts +1 -0
- package/components/fileCard/fileCardAssets.js +54 -0
- package/components/fileCard/fileCardUtils.d.ts +14 -0
- package/components/fileCard/fileCardUtils.js +94 -0
- package/components/fileCard/index.d.ts +2 -0
- package/components/fileCard/index.js +2 -0
- package/components/fileCard/index.spec.d.ts +1 -0
- package/components/fileCard/index.spec.js +1096 -0
- package/components/fileCard/list.d.ts +29 -0
- package/components/fileCard/list.js +46 -0
- package/components/fileCard/list.vdt.js +71 -0
- package/components/fileCard/styles.d.ts +5 -0
- package/components/fileCard/styles.js +83 -0
- package/components/fileCard/useFileCard.d.ts +45 -0
- package/components/fileCard/useFileCard.js +330 -0
- package/components/fileCard/useFileCardList.d.ts +14 -0
- package/components/fileCard/useFileCardList.js +49 -0
- package/components/form/form.js +2 -1
- package/components/media/context.d.ts +6 -0
- package/components/media/context.js +2 -0
- package/components/media/group.d.ts +12 -0
- package/components/media/group.js +32 -0
- package/components/media/group.vdt.js +50 -0
- package/components/media/index.d.ts +2 -0
- package/components/media/index.js +2 -0
- package/components/media/index.spec.d.ts +1 -0
- package/components/media/index.spec.js +1691 -0
- package/components/media/media.d.ts +37 -0
- package/components/media/media.js +67 -0
- package/components/media/media.vdt.js +202 -0
- package/components/media/mediaAssets.d.ts +4 -0
- package/components/media/mediaAssets.js +9 -0
- package/components/media/mediaUtils.d.ts +6 -0
- package/components/media/mediaUtils.js +66 -0
- package/components/media/styles.d.ts +13 -0
- package/components/media/styles.js +52 -0
- package/components/media/types.d.ts +37 -0
- package/components/media/types.js +1 -0
- package/components/media/useMedia.d.ts +70 -0
- package/components/media/useMedia.js +471 -0
- package/components/media/useMediaGroup.d.ts +15 -0
- package/components/media/useMediaGroup.js +136 -0
- package/components/media/useMediaViewer.d.ts +14 -0
- package/components/media/useMediaViewer.js +129 -0
- package/components/media/viewer.d.ts +24 -0
- package/components/media/viewer.js +54 -0
- package/components/media/viewer.vdt.js +100 -0
- package/components/radio/index.d.ts +3 -3
- package/components/sender/icons.d.ts +3 -0
- package/components/sender/icons.js +17 -0
- package/components/sender/index.d.ts +1 -0
- package/components/sender/index.js +1 -0
- package/components/sender/index.spec.d.ts +1 -0
- package/components/sender/index.spec.js +1597 -0
- package/components/sender/sender.d.ts +104 -0
- package/components/sender/sender.js +111 -0
- package/components/sender/sender.vdt.js +230 -0
- package/components/sender/styles.d.ts +5 -0
- package/components/sender/styles.js +56 -0
- package/components/sender/useAutoResize.d.ts +4 -0
- package/components/sender/useAutoResize.js +99 -0
- package/components/sender/useSenderDrag.d.ts +6 -0
- package/components/sender/useSenderDrag.js +320 -0
- package/components/sender/useSenderInput.d.ts +16 -0
- package/components/sender/useSenderInput.js +101 -0
- package/components/sender/useSenderPaste.d.ts +5 -0
- package/components/sender/useSenderPaste.js +36 -0
- package/components/sender/useSenderUpload.d.ts +11 -0
- package/components/sender/useSenderUpload.js +395 -0
- package/components/skeleton/skeleton.d.ts +2 -1
- package/components/skeleton/skeleton.js +1 -1
- package/components/think/index.d.ts +1 -0
- package/components/think/index.js +1 -0
- package/components/think/index.spec.d.ts +1 -0
- package/components/think/index.spec.js +345 -0
- package/components/think/index.vdt.js +82 -0
- package/components/think/styles.d.ts +5 -0
- package/components/think/styles.js +25 -0
- package/components/think/think.d.ts +28 -0
- package/components/think/think.js +48 -0
- package/components/think/useThinkExpand.d.ts +10 -0
- package/components/think/useThinkExpand.js +56 -0
- package/components/types.d.ts +4 -2
- package/components/upload/ajaxUploader.d.ts +1 -0
- package/components/upload/ajaxUploader.js +6 -0
- package/components/xmarkdown/index.d.ts +2 -0
- package/components/xmarkdown/index.js +1 -0
- package/components/xmarkdown/index.spec.d.ts +1 -0
- package/components/xmarkdown/index.spec.js +1666 -0
- package/components/xmarkdown/markdown/codeBlockRenderer.d.ts +8 -0
- package/components/xmarkdown/markdown/codeBlockRenderer.js +52 -0
- package/components/xmarkdown/markdown/codeblock.d.ts +8 -0
- package/components/xmarkdown/markdown/codeblock.js +74 -0
- package/components/xmarkdown/markdown/highlight.d.ts +17 -0
- package/components/xmarkdown/markdown/highlight.js +83 -0
- package/components/xmarkdown/markdown/index.d.ts +14 -0
- package/components/xmarkdown/markdown/index.js +14 -0
- package/components/xmarkdown/markdown/mermaid.d.ts +8 -0
- package/components/xmarkdown/markdown/mermaid.js +104 -0
- package/components/xmarkdown/markdown/renderTree.d.ts +54 -0
- package/components/xmarkdown/markdown/renderTree.js +386 -0
- package/components/xmarkdown/markdown/renderer.d.ts +18 -0
- package/components/xmarkdown/markdown/renderer.js +461 -0
- package/components/xmarkdown/markdown/streaming.d.ts +24 -0
- package/components/xmarkdown/markdown/streaming.js +513 -0
- package/components/xmarkdown/markdown/types.d.ts +124 -0
- package/components/xmarkdown/markdown/types.js +6 -0
- package/components/xmarkdown/markdown/utils.d.ts +7 -0
- package/components/xmarkdown/markdown/utils.js +9 -0
- package/components/xmarkdown/markdown.d.ts +1 -0
- package/components/xmarkdown/markdown.js +1 -0
- package/components/xmarkdown/styles.d.ts +5 -0
- package/components/xmarkdown/styles.js +50 -0
- package/components/xmarkdown/useMermaid.d.ts +27 -0
- package/components/xmarkdown/useMermaid.js +745 -0
- package/components/xmarkdown/useXMarkdownContent.d.ts +14 -0
- package/components/xmarkdown/useXMarkdownContent.js +218 -0
- package/components/xmarkdown/useXMarkdownDisplay.d.ts +26 -0
- package/components/xmarkdown/useXMarkdownDisplay.js +569 -0
- package/components/xmarkdown/xmarkdown.d.ts +61 -0
- package/components/xmarkdown/xmarkdown.js +109 -0
- package/components/xmarkdown/xmarkdown.vdt.js +43 -0
- package/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/i18n/en-US.js +29 -1
- package/dist/i18n/en-US.js.map +1 -1
- package/dist/i18n/en-US.min.js +1 -1
- package/dist/index.js +100506 -37457
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1569 -1
- package/dist/kpc.css +4 -0
- package/dist/ksyun.css +4 -0
- package/i18n/en-US.d.ts +27 -0
- package/i18n/en-US.js +29 -1
- package/index.d.ts +9 -2
- package/index.js +9 -2
- package/package.json +8 -2
- package/styles/global.js +12 -6
- package/yarn-error.log +0 -1012
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { css } from '@emotion/css';
|
|
2
|
+
import { theme, setDefault } from '../../styles/theme';
|
|
3
|
+
import { deepDefaults, setAlpha } from '../../styles/utils';
|
|
4
|
+
import '../../styles/global';
|
|
5
|
+
import { cache } from '../utils';
|
|
6
|
+
var defaults = {
|
|
7
|
+
gap: '12px',
|
|
8
|
+
padding: '12px',
|
|
9
|
+
avatarSize: '32px',
|
|
10
|
+
avatarFontSize: '12px',
|
|
11
|
+
avatarBg: '#dce6ee',
|
|
12
|
+
avatarColor: theme.color.text,
|
|
13
|
+
roundBorderRadius: '30px',
|
|
14
|
+
borderRadius: '8px',
|
|
15
|
+
border: "1px solid " + theme.color.border,
|
|
16
|
+
filledBg: '#ECF4FF',
|
|
17
|
+
filledColor: theme.color.text,
|
|
18
|
+
filledBorder: '1px solid transparent',
|
|
19
|
+
outlinedBg: '#fff',
|
|
20
|
+
outlinedColor: theme.color.text,
|
|
21
|
+
outlinedBorder: "1px solid #E5E8EE",
|
|
22
|
+
plainBg: 'transparent',
|
|
23
|
+
plainColor: theme.color.text,
|
|
24
|
+
plainBorder: '1px solid transparent',
|
|
25
|
+
roleNameColor: theme.color.title,
|
|
26
|
+
extraColor: theme.color.placeholder,
|
|
27
|
+
loadingTextColor: theme.color.lightBlack,
|
|
28
|
+
get loadingDotColor() {
|
|
29
|
+
return theme.color.primary;
|
|
30
|
+
},
|
|
31
|
+
loadingDotSize: '8px',
|
|
32
|
+
markdownCodeBg: '#eef2f6',
|
|
33
|
+
markdownCodeColor: '#2f4554',
|
|
34
|
+
markdownPreBg: '#10161c',
|
|
35
|
+
markdownPreColor: '#f5f7fa',
|
|
36
|
+
markdownBorderColor: '#dde4ea',
|
|
37
|
+
markdownTableHeadBg: '#f7f9fb',
|
|
38
|
+
markdownHeadingColor: '#18212a',
|
|
39
|
+
get markdownLinkColor() {
|
|
40
|
+
return theme.color.primary;
|
|
41
|
+
},
|
|
42
|
+
markdownBlockquoteBg: '#f6f8fa'
|
|
43
|
+
};
|
|
44
|
+
var bubble;
|
|
45
|
+
setDefault(function () {
|
|
46
|
+
bubble = deepDefaults(theme, {
|
|
47
|
+
bubble: defaults
|
|
48
|
+
}).bubble;
|
|
49
|
+
makeStyles == null || makeStyles.clearCache();
|
|
50
|
+
});
|
|
51
|
+
export var makeStyles = cache(function makeStyles(k) {
|
|
52
|
+
return /*#__PURE__*/css("display:flex;flex-direction:column;align-items:flex-start;width:100%;.", k, "-bubble-main{display:flex;flex-direction:column;gap:8px;min-width:0;align-items:flex-start;}.", k, "-bubble-meta{display:flex;align-items:center;gap:8px;min-width:0;}.", k, "-bubble-header{color:", bubble.roleNameColor, ";font-size:14px;font-weight:500;min-width:0;text-align:left;}.", k, "-bubble-content{display:flex;flex-direction:column;gap:8px;min-width:0;max-width:100%;padding:", bubble.padding, ";box-sizing:border-box;line-height:1.6;word-break:break-word;overflow-wrap:anywhere;transition:background ", theme.transition.small, ",border-color ", theme.transition.small, ";}.", k, "-bubble-content>*{min-width:0;max-width:100%;}.", k, "-bubble-attachments{display:flex;flex-direction:column;gap:12px;min-width:0;max-width:100%;}.", k, "-bubble-before-content{min-width:0;width:100%;}.", k, "-bubble-text{white-space:pre-wrap;}.", k, "-bubble-loading{display:inline-flex;align-items:center;gap:8px;color:", bubble.loadingTextColor, ";min-height:20px;}.", k, "-bubble-loading-dot{width:", bubble.loadingDotSize, ";height:", bubble.loadingDotSize, ";border-radius:50%;background:", bubble.loadingDotColor, ";display:inline-block;animation:", k, "-bubble-loading-bounce 1s ease-in-out infinite;box-shadow:0 0 0 1px ", setAlpha(theme.color.primary, 0.04), ";}.", k, "-bubble-loading-dot:nth-of-type(2){animation-delay:0.14s;}.", k, "-bubble-loading-dot:nth-of-type(3){animation-delay:0.28s;}.", k, "-bubble-footer{display:flex;align-items:center;gap:4px;}.", k, "-bubble-extra{color:", bubble.extraColor, ";font-size:12px;line-height:1.5;}.", k, "-bubble-avatar{width:", bubble.avatarSize, ";height:", bubble.avatarSize, ";flex:0 0 ", bubble.avatarSize, ";border-radius:50%;overflow:hidden;display:inline-flex;align-items:center;justify-content:center;background:", bubble.avatarBg, ";color:", bubble.avatarColor, ";font-size:", bubble.avatarFontSize, ";font-weight:600;}.", k, "-bubble-avatar-image{width:100%;height:100%;object-fit:cover;display:block;}.", k, "-bubble-markdown{color:inherit;overflow-x:auto;}.", k, "-bubble-markdown>:first-child{margin-top:0;}.", k, "-bubble-markdown>:last-child{margin-bottom:0;}.", k, "-bubble-markdown [data-kpc-bubble-markdown-tail]{display:inline;white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere;}.", k, "-bubble-markdown p,.", k, "-bubble-markdown ul,.", k, "-bubble-markdown ol,.", k, "-bubble-markdown blockquote,.", k, "-bubble-markdown pre,.", k, "-bubble-markdown table,.", k, "-bubble-markdown hr,.", k, "-bubble-markdown h1,.", k, "-bubble-markdown h2,.", k, "-bubble-markdown h3,.", k, "-bubble-markdown h4,.", k, "-bubble-markdown h5,.", k, "-bubble-markdown h6{margin:0 0 10px;}.", k, "-bubble-markdown ul,.", k, "-bubble-markdown ol{padding-left:20px;list-style-position:outside;}.", k, "-bubble-markdown ul{list-style-type:disc;}.", k, "-bubble-markdown ul ul{list-style-type:circle;}.", k, "-bubble-markdown ul ul ul{list-style-type:square;}.", k, "-bubble-markdown ol{list-style-type:decimal;}.", k, "-bubble-markdown ol ol{list-style-type:lower-alpha;}.", k, "-bubble-markdown li{margin:6px 0;}.", k, "-bubble-markdown li>p{margin:6px 0 0;}.", k, "-bubble-markdown h1,.", k, "-bubble-markdown h2,.", k, "-bubble-markdown h3,.", k, "-bubble-markdown h4,.", k, "-bubble-markdown h5,.", k, "-bubble-markdown h6{color:", bubble.markdownHeadingColor, ";font-weight:600;line-height:1.35;}.", k, "-bubble-markdown h1{font-size:22px;}.", k, "-bubble-markdown h2{font-size:18px;}.", k, "-bubble-markdown h3{font-size:16px;}.", k, "-bubble-markdown h4{font-size:14px;}.", k, "-bubble-markdown h5,.", k, "-bubble-markdown h6{font-size:13px;}.", k, "-bubble-markdown a{color:", bubble.markdownLinkColor, ";text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px;}.", k, "-bubble-markdown a:hover{opacity:0.88;}.", k, "-bubble-markdown code{display:inline-block;padding:0 6px;border-radius:4px;background:", bubble.markdownCodeBg, ";color:", bubble.markdownCodeColor, ";font-family:SFMono-Regular,Consolas,'Liberation Mono',Menlo,monospace;font-size:12px;white-space:break-spaces;}.", k, "-bubble-markdown strong,.", k, "-bubble-markdown b{font-weight:600;}.", k, "-bubble-markdown img{display:block;max-width:100%;height:auto;margin:12px 0;border-radius:12px;}.", k, "-bubble-markdown hr{height:1px;border:0;background:", bubble.markdownBorderColor, ";}.", k, "-bubble-markdown pre{padding:0px;overflow:auto;background:", bubble.markdownPreBg, ";color:", bubble.markdownPreColor, ";border:1px solid ", setAlpha('#ffffff', 0.06), ";}.", k, "-bubble-markdown pre code{display:block;padding:4px;background:transparent;color:inherit;white-space:pre;word-break:normal;overflow-wrap:normal;}.", k, "-bubble-markdown .hljs{background:transparent;color:inherit;}.", k, "-bubble-markdown .hljs-comment,.", k, "-bubble-markdown .hljs-quote{color:#8fa1b3;}.", k, "-bubble-markdown .hljs-keyword,.", k, "-bubble-markdown .hljs-selector-tag,.", k, "-bubble-markdown .hljs-literal,.", k, "-bubble-markdown .hljs-section,.", k, "-bubble-markdown .hljs-link{color:#ffb86c;}.", k, "-bubble-markdown .hljs-string,.", k, "-bubble-markdown .hljs-title,.", k, "-bubble-markdown .hljs-name,.", k, "-bubble-markdown .hljs-type,.", k, "-bubble-markdown .hljs-attribute,.", k, "-bubble-markdown .hljs-symbol,.", k, "-bubble-markdown .hljs-bullet,.", k, "-bubble-markdown .hljs-addition{color:#7ee787;}.", k, "-bubble-markdown .hljs-number,.", k, "-bubble-markdown .hljs-built_in,.", k, "-bubble-markdown .hljs-builtin-name,.", k, "-bubble-markdown .hljs-variable,.", k, "-bubble-markdown .hljs-template-variable{color:#79c0ff;}.", k, "-bubble-markdown .hljs-deletion{color:#ff7b72;}.", k, "-bubble-markdown table{width:100%;border-collapse:collapse;border-spacing:0;border:1px solid ", bubble.markdownBorderColor, ";border-radius:10px;overflow:hidden;font-size:12px;background:transparent;}.", k, "-bubble-markdown th,.", k, "-bubble-markdown td{padding:8px 12px;border:1px solid ", bubble.markdownBorderColor, ";text-align:left;vertical-align:top;}.", k, "-bubble-markdown th{font-weight:600;background:", bubble.markdownTableHeadBg, ";}.", k, "-bubble-markdown blockquote{padding-left:12px;border-left:3px solid ", setAlpha(theme.color.text, 0.16), ";background:", bubble.markdownBlockquoteBg, ";border-radius:0 10px 10px 0;padding:8px 12px;opacity:0.96;}.", k, "-bubble-markdown blockquote>:last-child{margin-bottom:0;}&.", k, "-bubble-start{align-items:flex-start;}&.", k, "-bubble-start .", k, "-bubble-main{align-items:flex-start;}&.", k, "-bubble-end{align-items:flex-end;}&.", k, "-bubble-end .", k, "-bubble-main{align-items:flex-end;}&.", k, "-bubble-end .", k, "-bubble-meta{flex-direction:row-reverse;justify-content:flex-end;}&.", k, "-bubble-end .", k, "-bubble-header{text-align:right;}&.", k, "-bubble-middle{align-items:center;}&.", k, "-bubble-middle .", k, "-bubble-main{align-items:center;}&.", k, "-bubble-middle .", k, "-bubble-meta{justify-content:center;}&.", k, "-bubble-middle .", k, "-bubble-header{text-align:center;}&.", k, "-bubble-filled .", k, "-bubble-content{background:", bubble.filledBg, ";color:", bubble.filledColor, ";border:", bubble.filledBorder, ";}&.", k, "-bubble-outlined .", k, "-bubble-content{background:", bubble.outlinedBg, ";color:", bubble.outlinedColor, ";border:", bubble.outlinedBorder, ";}&.", k, "-bubble-plain .", k, "-bubble-content{background:", bubble.plainBg, ";color:", bubble.plainColor, ";border:", bubble.plainBorder, ";padding:0;}&.", k, "-bubble-round .", k, "-bubble-content{border-radius:", bubble.roundBorderRadius, ";}&.", k, "-bubble-corner.", k, "-bubble-start .", k, "-bubble-content{border-radius:", bubble.borderRadius, " ", bubble.borderRadius, " ", bubble.borderRadius, " 0;}&.", k, "-bubble-corner.", k, "-bubble-end .", k, "-bubble-content{border-radius:", bubble.borderRadius, " ", bubble.borderRadius, " 0 ", bubble.borderRadius, ";}&.", k, "-bubble-corner.", k, "-bubble-middle .", k, "-bubble-content{border-radius:", bubble.borderRadius, ";}&.", k, "-bubble-square .", k, "-bubble-content{border-radius:", bubble.borderRadius, ";}@keyframes ", k, "-bubble-loading-bounce{0%,80%,100%{transform:translateY(0) scale(0.9);opacity:0.45;}40%{transform:translateY(-5px) scale(1);opacity:1;}}");
|
|
53
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare function useBubbleDisplay(): {
|
|
2
|
+
onMounted: () => void;
|
|
3
|
+
onBeforeUnmount: () => void;
|
|
4
|
+
hasContentProp: () => boolean;
|
|
5
|
+
hasNonEmptyContentProp: () => boolean;
|
|
6
|
+
hasVisibleContent: () => boolean;
|
|
7
|
+
shouldShowContentBlock: () => boolean;
|
|
8
|
+
shouldShowLoadingShell: () => boolean;
|
|
9
|
+
getDisplayedContent: () => string;
|
|
10
|
+
isTypingActive: () => boolean;
|
|
11
|
+
getBubbleStyle: () => {
|
|
12
|
+
maxWidth: string;
|
|
13
|
+
} | undefined;
|
|
14
|
+
getRoleNameText: () => string;
|
|
15
|
+
hasRoleName: () => boolean;
|
|
16
|
+
shouldShowAvatar: () => boolean;
|
|
17
|
+
getAvatarText: () => string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/slice";
|
|
2
|
+
import _trimInstanceProperty from "@babel/runtime-corejs3/core-js/instance/trim";
|
|
3
|
+
import { useInstance } from 'intact-vue-next';
|
|
4
|
+
// 维护 Bubble 的可见内容:loading 清空、typing 推进、streaming 完成事件都在这里收口。
|
|
5
|
+
export function useBubbleDisplay() {
|
|
6
|
+
var instance = useInstance();
|
|
7
|
+
var typingTimer = null;
|
|
8
|
+
var lastCompletedContent = null;
|
|
9
|
+
var previousContent = instance.get('content');
|
|
10
|
+
var previousLoading = !!instance.get('loading');
|
|
11
|
+
var previousStreaming = !!instance.get('streaming');
|
|
12
|
+
var hasPendingCompletion = previousLoading || previousStreaming;
|
|
13
|
+
function setDisplayContent(value) {
|
|
14
|
+
if (instance.get('$displayContent') === value) return false;
|
|
15
|
+
instance.set('$displayContent', value);
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
function setTypingActive(value) {
|
|
19
|
+
if (instance.get('$typingActive') === value) return;
|
|
20
|
+
instance.set('$typingActive', value);
|
|
21
|
+
}
|
|
22
|
+
function getTypingOptions() {
|
|
23
|
+
var typing = instance.get('typing');
|
|
24
|
+
if (typing && typeof typing === 'object') {
|
|
25
|
+
return {
|
|
26
|
+
interval: Math.max(typing.interval || 24, 16),
|
|
27
|
+
step: Math.max(typing.step || 2, 1)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
interval: 24,
|
|
32
|
+
step: 2
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function stopTyping() {
|
|
36
|
+
if (typingTimer) {
|
|
37
|
+
clearTimeout(typingTimer);
|
|
38
|
+
typingTimer = null;
|
|
39
|
+
}
|
|
40
|
+
setTypingActive(false);
|
|
41
|
+
}
|
|
42
|
+
function resetTypingComplete() {
|
|
43
|
+
lastCompletedContent = null;
|
|
44
|
+
}
|
|
45
|
+
// 同一轮内容只触发一次完成事件,避免 streaming 结束和 typing 追平重复通知。
|
|
46
|
+
function triggerTypingComplete(content) {
|
|
47
|
+
if (lastCompletedContent === content) return;
|
|
48
|
+
lastCompletedContent = content;
|
|
49
|
+
hasPendingCompletion = false;
|
|
50
|
+
instance.trigger('typingComplete', content);
|
|
51
|
+
}
|
|
52
|
+
function finishTyping(content) {
|
|
53
|
+
stopTyping();
|
|
54
|
+
triggerTypingComplete(content);
|
|
55
|
+
}
|
|
56
|
+
// 同步完成状态,检测状态变化以判断是否需要触发typingComplete事件
|
|
57
|
+
function syncCompletionState() {
|
|
58
|
+
var content = instance.get('content');
|
|
59
|
+
var loading = !!instance.get('loading');
|
|
60
|
+
var streaming = !!instance.get('streaming');
|
|
61
|
+
if (content !== previousContent || loading && !previousLoading || streaming && !previousStreaming) {
|
|
62
|
+
hasPendingCompletion = true;
|
|
63
|
+
}
|
|
64
|
+
previousContent = content;
|
|
65
|
+
previousLoading = loading;
|
|
66
|
+
previousStreaming = streaming;
|
|
67
|
+
}
|
|
68
|
+
function shouldEmitTypingComplete(content) {
|
|
69
|
+
return content.length > 0 || hasPendingCompletion;
|
|
70
|
+
}
|
|
71
|
+
function getDisplayedContent() {
|
|
72
|
+
return instance.get('$displayContent') || '';
|
|
73
|
+
}
|
|
74
|
+
// 获取共享前缀
|
|
75
|
+
function getSharedPrefix(content) {
|
|
76
|
+
var displayedContent = getDisplayedContent();
|
|
77
|
+
// 避免 startsWith 依赖,兼容旧运行环境。
|
|
78
|
+
if (!displayedContent || _sliceInstanceProperty(content).call(content, 0, displayedContent.length) === displayedContent) {
|
|
79
|
+
return displayedContent;
|
|
80
|
+
}
|
|
81
|
+
var i = 0;
|
|
82
|
+
while (i < displayedContent.length && i < content.length && displayedContent[i] === content[i]) {
|
|
83
|
+
i++;
|
|
84
|
+
}
|
|
85
|
+
return _sliceInstanceProperty(displayedContent).call(displayedContent, 0, i);
|
|
86
|
+
}
|
|
87
|
+
// 开始打字动画
|
|
88
|
+
function startTyping(immediate) {
|
|
89
|
+
if (immediate === void 0) {
|
|
90
|
+
immediate = false;
|
|
91
|
+
}
|
|
92
|
+
if (typingTimer) return;
|
|
93
|
+
if (immediate) {
|
|
94
|
+
setTypingActive(true);
|
|
95
|
+
runTyping();
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
var _getTypingOptions = getTypingOptions(),
|
|
99
|
+
interval = _getTypingOptions.interval;
|
|
100
|
+
setTypingActive(true);
|
|
101
|
+
typingTimer = window.setTimeout(function () {
|
|
102
|
+
typingTimer = null;
|
|
103
|
+
runTyping();
|
|
104
|
+
}, interval);
|
|
105
|
+
}
|
|
106
|
+
// 运行打字动画
|
|
107
|
+
function runTyping() {
|
|
108
|
+
syncCompletionState();
|
|
109
|
+
var content = instance.get('content');
|
|
110
|
+
var nextValue = content === undefined || content === null ? '' : String(content);
|
|
111
|
+
if (instance.get('loading')) {
|
|
112
|
+
stopTyping();
|
|
113
|
+
resetTypingComplete();
|
|
114
|
+
setDisplayContent('');
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (!instance.get('typing') || !nextValue) {
|
|
118
|
+
stopTyping();
|
|
119
|
+
setDisplayContent(nextValue);
|
|
120
|
+
if (!instance.get('streaming') && shouldEmitTypingComplete(nextValue)) {
|
|
121
|
+
triggerTypingComplete(nextValue);
|
|
122
|
+
}
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
var sharedPrefix = getSharedPrefix(nextValue);
|
|
126
|
+
if (sharedPrefix !== getDisplayedContent()) {
|
|
127
|
+
resetTypingComplete();
|
|
128
|
+
setDisplayContent(sharedPrefix);
|
|
129
|
+
}
|
|
130
|
+
var currentValue = getDisplayedContent();
|
|
131
|
+
var _getTypingOptions2 = getTypingOptions(),
|
|
132
|
+
interval = _getTypingOptions2.interval,
|
|
133
|
+
step = _getTypingOptions2.step;
|
|
134
|
+
if (currentValue !== nextValue) {
|
|
135
|
+
var nextLength = Math.min(currentValue.length + step, nextValue.length);
|
|
136
|
+
var renderedContent = _sliceInstanceProperty(nextValue).call(nextValue, 0, nextLength);
|
|
137
|
+
setDisplayContent(renderedContent);
|
|
138
|
+
instance.trigger('typing', renderedContent, nextValue);
|
|
139
|
+
}
|
|
140
|
+
if (getDisplayedContent() === nextValue) {
|
|
141
|
+
if (instance.get('streaming')) {
|
|
142
|
+
stopTyping();
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
finishTyping(nextValue);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
setTypingActive(true);
|
|
149
|
+
typingTimer = window.setTimeout(function () {
|
|
150
|
+
typingTimer = null;
|
|
151
|
+
runTyping();
|
|
152
|
+
}, interval);
|
|
153
|
+
}
|
|
154
|
+
// 同步显示内容,处理打字动画、流式输出、加载状态等
|
|
155
|
+
function syncDisplayContent() {
|
|
156
|
+
syncCompletionState();
|
|
157
|
+
if (instance.get('loading')) {
|
|
158
|
+
stopTyping();
|
|
159
|
+
resetTypingComplete();
|
|
160
|
+
setDisplayContent('');
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
var content = instance.get('content');
|
|
164
|
+
var nextValue = content === undefined || content === null ? '' : String(content);
|
|
165
|
+
var typing = instance.get('typing');
|
|
166
|
+
var streaming = instance.get('streaming');
|
|
167
|
+
if (!nextValue) {
|
|
168
|
+
stopTyping();
|
|
169
|
+
setDisplayContent(nextValue);
|
|
170
|
+
if (!streaming && shouldEmitTypingComplete(nextValue)) {
|
|
171
|
+
triggerTypingComplete(nextValue);
|
|
172
|
+
}
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (!typing) {
|
|
176
|
+
stopTyping();
|
|
177
|
+
setDisplayContent(nextValue);
|
|
178
|
+
if (!streaming && shouldEmitTypingComplete(nextValue)) {
|
|
179
|
+
triggerTypingComplete(nextValue);
|
|
180
|
+
}
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
var sharedPrefix = getSharedPrefix(nextValue);
|
|
184
|
+
if (sharedPrefix !== getDisplayedContent()) {
|
|
185
|
+
// 内容被修订时保留共享前缀,避免流式修正时整段闪烁。
|
|
186
|
+
stopTyping();
|
|
187
|
+
resetTypingComplete();
|
|
188
|
+
setDisplayContent(sharedPrefix);
|
|
189
|
+
}
|
|
190
|
+
if (getDisplayedContent() === nextValue) {
|
|
191
|
+
if (!streaming) {
|
|
192
|
+
finishTyping(nextValue);
|
|
193
|
+
} else {
|
|
194
|
+
stopTyping();
|
|
195
|
+
}
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
startTyping(!getDisplayedContent());
|
|
199
|
+
}
|
|
200
|
+
// 初始化状态和绑定监听器
|
|
201
|
+
function bootstrap() {
|
|
202
|
+
var content = instance.get('content');
|
|
203
|
+
setTypingActive(false);
|
|
204
|
+
setDisplayContent(!instance.get('loading') && !instance.get('typing') && content !== undefined && content !== null ? String(content) : '');
|
|
205
|
+
instance.watch('content', function () {
|
|
206
|
+
return syncDisplayContent();
|
|
207
|
+
}, {
|
|
208
|
+
inited: true
|
|
209
|
+
});
|
|
210
|
+
instance.watch('loading', function () {
|
|
211
|
+
return syncDisplayContent();
|
|
212
|
+
}, {
|
|
213
|
+
inited: true
|
|
214
|
+
});
|
|
215
|
+
instance.watch('streaming', function () {
|
|
216
|
+
return syncDisplayContent();
|
|
217
|
+
}, {
|
|
218
|
+
inited: true
|
|
219
|
+
});
|
|
220
|
+
instance.watch('typing', function () {
|
|
221
|
+
return syncDisplayContent();
|
|
222
|
+
}, {
|
|
223
|
+
inited: true
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
bootstrap();
|
|
227
|
+
function hasContentProp() {
|
|
228
|
+
var content = instance.get('content');
|
|
229
|
+
return content !== undefined && content !== null;
|
|
230
|
+
}
|
|
231
|
+
function hasNonEmptyContentProp() {
|
|
232
|
+
var content = instance.get('content');
|
|
233
|
+
if (content === undefined || content === null) return false;
|
|
234
|
+
return String(content).length > 0;
|
|
235
|
+
}
|
|
236
|
+
function hasVisibleContent() {
|
|
237
|
+
return !!getDisplayedContent();
|
|
238
|
+
}
|
|
239
|
+
function shouldShowContentBlock() {
|
|
240
|
+
return instance.get('loading') || instance.get('streaming') || hasVisibleContent() || hasNonEmptyContentProp();
|
|
241
|
+
}
|
|
242
|
+
function shouldShowLoadingShell() {
|
|
243
|
+
var loading = instance.get('loading');
|
|
244
|
+
if (loading) return true;
|
|
245
|
+
var visible = hasVisibleContent();
|
|
246
|
+
if (visible) return false;
|
|
247
|
+
if (instance.get('streaming')) {
|
|
248
|
+
return true;
|
|
249
|
+
}
|
|
250
|
+
return !!instance.get('typing') && hasNonEmptyContentProp();
|
|
251
|
+
}
|
|
252
|
+
function isTypingActive() {
|
|
253
|
+
return !!instance.get('$typingActive');
|
|
254
|
+
}
|
|
255
|
+
function getBubbleStyle() {
|
|
256
|
+
var maxWidthString = instance.get('maxWidthString');
|
|
257
|
+
if (!maxWidthString) return;
|
|
258
|
+
return {
|
|
259
|
+
maxWidth: maxWidthString
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function getRoleNameText() {
|
|
263
|
+
return instance.get('roleName') || '';
|
|
264
|
+
}
|
|
265
|
+
function hasRoleName() {
|
|
266
|
+
return !!getRoleNameText();
|
|
267
|
+
}
|
|
268
|
+
function shouldShowAvatar() {
|
|
269
|
+
var avatar = instance.get('avatar');
|
|
270
|
+
return avatar !== false;
|
|
271
|
+
}
|
|
272
|
+
function getAvatarText() {
|
|
273
|
+
var _context;
|
|
274
|
+
var roleName = _trimInstanceProperty(_context = getRoleNameText()).call(_context);
|
|
275
|
+
if (roleName) {
|
|
276
|
+
return roleName.charAt(0).toUpperCase();
|
|
277
|
+
}
|
|
278
|
+
return '';
|
|
279
|
+
}
|
|
280
|
+
return {
|
|
281
|
+
onMounted: function onMounted() {
|
|
282
|
+
return syncDisplayContent();
|
|
283
|
+
},
|
|
284
|
+
onBeforeUnmount: function onBeforeUnmount() {
|
|
285
|
+
stopTyping();
|
|
286
|
+
},
|
|
287
|
+
hasContentProp: hasContentProp,
|
|
288
|
+
hasNonEmptyContentProp: hasNonEmptyContentProp,
|
|
289
|
+
hasVisibleContent: hasVisibleContent,
|
|
290
|
+
shouldShowContentBlock: shouldShowContentBlock,
|
|
291
|
+
shouldShowLoadingShell: shouldShowLoadingShell,
|
|
292
|
+
getDisplayedContent: getDisplayedContent,
|
|
293
|
+
isTypingActive: isTypingActive,
|
|
294
|
+
getBubbleStyle: getBubbleStyle,
|
|
295
|
+
getRoleNameText: getRoleNameText,
|
|
296
|
+
hasRoleName: hasRoleName,
|
|
297
|
+
shouldShowAvatar: shouldShowAvatar,
|
|
298
|
+
getAvatarText: getAvatarText
|
|
299
|
+
};
|
|
300
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Component, TypeDefs } from 'intact-vue-next';
|
|
2
|
+
import type { Events } from '../types';
|
|
3
|
+
import type { BubbleProps } from '../bubble';
|
|
4
|
+
export type BubbleListKey = string | number;
|
|
5
|
+
export interface BubbleListRoleConfig extends Partial<BubbleProps> {
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: any;
|
|
8
|
+
onTyping?: (renderedContent: string, currentContent: string, item: BubbleListItem, index: number) => void;
|
|
9
|
+
onTypingComplete?: (content: string, item: BubbleListItem, index: number) => void;
|
|
10
|
+
}
|
|
11
|
+
export interface BubbleListItem extends Partial<BubbleProps> {
|
|
12
|
+
key?: BubbleListKey;
|
|
13
|
+
role?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: any;
|
|
16
|
+
onTyping?: BubbleListRoleConfig['onTyping'];
|
|
17
|
+
onTypingComplete?: BubbleListRoleConfig['onTypingComplete'];
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}
|
|
20
|
+
export type BubbleListRoleMap = Record<string, BubbleListRoleConfig | ((item: BubbleListItem, index: number) => BubbleListRoleConfig)>;
|
|
21
|
+
export interface BubbleListProps {
|
|
22
|
+
items?: BubbleListItem[];
|
|
23
|
+
itemKey?: string | ((item: BubbleListItem, index: number) => BubbleListKey);
|
|
24
|
+
autoScroll?: boolean;
|
|
25
|
+
autoScrollThreshold?: number;
|
|
26
|
+
maxHeight?: number | string;
|
|
27
|
+
historyTriggerOffset?: number;
|
|
28
|
+
hasMoreHistory?: boolean;
|
|
29
|
+
loadingHistory?: boolean;
|
|
30
|
+
roles?: BubbleListRoleMap;
|
|
31
|
+
scrollBehavior?: 'auto' | 'smooth';
|
|
32
|
+
showScrollToBottom?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface BubbleListSlotParams {
|
|
35
|
+
item: BubbleListItem;
|
|
36
|
+
mergedItem: BubbleListItem;
|
|
37
|
+
index: number;
|
|
38
|
+
key: BubbleListKey;
|
|
39
|
+
isFirst: boolean;
|
|
40
|
+
isLast: boolean;
|
|
41
|
+
isAtBottom: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface HistoryLoadingSlotParams {
|
|
44
|
+
loadingHistory: boolean;
|
|
45
|
+
hasMoreHistory: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface ScrollToBottomSlotParams {
|
|
48
|
+
isAtBottom: boolean;
|
|
49
|
+
scrollToBottom: () => void;
|
|
50
|
+
}
|
|
51
|
+
export interface BubbleListEvents {
|
|
52
|
+
loadHistory: [];
|
|
53
|
+
scroll: [Event];
|
|
54
|
+
scrollBottomChange: [boolean];
|
|
55
|
+
autoScrollChange: [boolean];
|
|
56
|
+
typing: [BubbleListItem, string, string, number];
|
|
57
|
+
typingComplete: [BubbleListItem, string, number];
|
|
58
|
+
}
|
|
59
|
+
export interface BubbleListBlocks {
|
|
60
|
+
header: null;
|
|
61
|
+
listFooter: null;
|
|
62
|
+
empty: null;
|
|
63
|
+
historyLoading: HistoryLoadingSlotParams;
|
|
64
|
+
scrollToBottom: ScrollToBottomSlotParams;
|
|
65
|
+
item: BubbleListSlotParams;
|
|
66
|
+
avatar: BubbleListSlotParams;
|
|
67
|
+
roleName: BubbleListSlotParams;
|
|
68
|
+
beforeContent: BubbleListSlotParams;
|
|
69
|
+
attachments: BubbleListSlotParams;
|
|
70
|
+
content: BubbleListSlotParams;
|
|
71
|
+
bottom: BubbleListSlotParams;
|
|
72
|
+
loading: BubbleListSlotParams;
|
|
73
|
+
footer: BubbleListSlotParams;
|
|
74
|
+
extra: BubbleListSlotParams;
|
|
75
|
+
}
|
|
76
|
+
export declare class BubbleList extends Component<BubbleListProps, BubbleListEvents, BubbleListBlocks> {
|
|
77
|
+
static template: string | import('intact-vue-next').Template<any>;
|
|
78
|
+
static typeDefs: Required<TypeDefs<BubbleListProps>>;
|
|
79
|
+
static defaults: () => Partial<BubbleListProps>;
|
|
80
|
+
static events: Events<BubbleListEvents>;
|
|
81
|
+
private config;
|
|
82
|
+
private bubbleList;
|
|
83
|
+
scrollToBottom(behavior?: ScrollBehavior): void;
|
|
84
|
+
scrollToTop(behavior?: ScrollBehavior): void;
|
|
85
|
+
scrollToKey(key: BubbleListKey, behavior?: ScrollBehavior): void;
|
|
86
|
+
isAtBottom(): boolean;
|
|
87
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import { Component } from 'intact-vue-next';
|
|
4
|
+
import template from './bubbleList.vdt';
|
|
5
|
+
import { useConfigContext } from '../config';
|
|
6
|
+
import { useBubbleList } from './useBubbleList';
|
|
7
|
+
var typeDefs = {
|
|
8
|
+
items: Array,
|
|
9
|
+
itemKey: [String, Function],
|
|
10
|
+
autoScroll: Boolean,
|
|
11
|
+
autoScrollThreshold: Number,
|
|
12
|
+
maxHeight: [Number, String],
|
|
13
|
+
historyTriggerOffset: Number,
|
|
14
|
+
hasMoreHistory: Boolean,
|
|
15
|
+
loadingHistory: Boolean,
|
|
16
|
+
roles: Object,
|
|
17
|
+
scrollBehavior: ['auto', 'smooth'],
|
|
18
|
+
showScrollToBottom: Boolean
|
|
19
|
+
};
|
|
20
|
+
var defaults = function defaults() {
|
|
21
|
+
return {
|
|
22
|
+
items: [],
|
|
23
|
+
itemKey: undefined,
|
|
24
|
+
autoScroll: true,
|
|
25
|
+
autoScrollThreshold: 80,
|
|
26
|
+
maxHeight: undefined,
|
|
27
|
+
historyTriggerOffset: 24,
|
|
28
|
+
hasMoreHistory: false,
|
|
29
|
+
loadingHistory: false,
|
|
30
|
+
roles: undefined,
|
|
31
|
+
scrollBehavior: 'auto',
|
|
32
|
+
showScrollToBottom: true
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
var events = {
|
|
36
|
+
loadHistory: true,
|
|
37
|
+
scroll: true,
|
|
38
|
+
scrollBottomChange: true,
|
|
39
|
+
autoScrollChange: true,
|
|
40
|
+
typing: true,
|
|
41
|
+
typingComplete: true
|
|
42
|
+
};
|
|
43
|
+
export var BubbleList = /*#__PURE__*/function (_Component) {
|
|
44
|
+
_inheritsLoose(BubbleList, _Component);
|
|
45
|
+
function BubbleList() {
|
|
46
|
+
var _context;
|
|
47
|
+
var _this;
|
|
48
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
49
|
+
args[_key] = arguments[_key];
|
|
50
|
+
}
|
|
51
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
52
|
+
_this.config = useConfigContext();
|
|
53
|
+
_this.bubbleList = useBubbleList();
|
|
54
|
+
return _this;
|
|
55
|
+
}
|
|
56
|
+
var _proto = BubbleList.prototype;
|
|
57
|
+
// 对外只暴露滚动能力,具体 DOM 和贴底状态由 useBubbleList 维护。
|
|
58
|
+
_proto.scrollToBottom = function scrollToBottom(behavior) {
|
|
59
|
+
this.bubbleList.scrollToBottom(behavior);
|
|
60
|
+
};
|
|
61
|
+
_proto.scrollToTop = function scrollToTop(behavior) {
|
|
62
|
+
this.bubbleList.scrollToTop(behavior);
|
|
63
|
+
};
|
|
64
|
+
_proto.scrollToKey = function scrollToKey(key, behavior) {
|
|
65
|
+
this.bubbleList.scrollToKey(key, behavior);
|
|
66
|
+
};
|
|
67
|
+
_proto.isAtBottom = function isAtBottom() {
|
|
68
|
+
return this.bubbleList.isAtBottom();
|
|
69
|
+
};
|
|
70
|
+
return BubbleList;
|
|
71
|
+
}(Component);
|
|
72
|
+
BubbleList.template = template;
|
|
73
|
+
BubbleList.typeDefs = typeDefs;
|
|
74
|
+
BubbleList.defaults = defaults;
|
|
75
|
+
BubbleList.events = events;
|