@king-design/vue 3.8.0-beta.0 → 3.8.0-beta.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.
- package/__tests__/__snapshots__/Vue Next Demos.md +74 -74
- package/components/bubble/bubble.d.ts +3 -0
- package/components/bubble/bubble.vdt.js +6 -2
- package/components/bubble/index.spec.js +231 -5
- package/components/bubble/styles.js +1 -1
- package/components/bubble/useBubbleDisplay.d.ts +1 -0
- package/components/bubble/useBubbleDisplay.js +68 -22
- package/components/bubbleList/bubbleList.vdt.js +3 -1
- package/components/bubbleList/index.spec.js +378 -237
- package/components/bubbleList/styles.js +2 -2
- package/components/bubbleList/useBubbleList.js +7 -0
- package/components/fileCard/fileCard.vdt.js +4 -4
- package/components/fileCard/index.spec.js +179 -107
- package/components/fileCard/list.d.ts +2 -1
- package/components/fileCard/list.vdt.js +7 -5
- package/components/fileCard/styles.js +10 -8
- package/components/fileCard/useFileCard.d.ts +1 -1
- package/components/fileCard/useFileCard.js +6 -35
- package/components/media/index.spec.js +774 -585
- package/components/media/media.vdt.js +17 -6
- package/components/media/mediaAssets.d.ts +2 -0
- package/components/media/mediaAssets.js +4 -0
- package/components/media/styles.js +5 -3
- package/components/media/useMedia.d.ts +6 -2
- package/components/media/useMedia.js +28 -6
- package/components/sender/index.spec.js +1146 -476
- package/components/sender/sender.d.ts +28 -5
- package/components/sender/sender.js +17 -6
- package/components/sender/sender.vdt.js +121 -49
- package/components/sender/styles.js +18 -9
- package/components/sender/useAutoResize.js +7 -6
- package/components/sender/useSenderDrag.js +12 -3
- package/components/sender/useSenderInput.d.ts +3 -0
- package/components/sender/useSenderInput.js +20 -3
- package/components/sender/useSenderPaste.js +1 -1
- package/components/sender/useSenderUpload.js +38 -29
- package/components/xmarkdown/index.spec.js +492 -263
- package/components/xmarkdown/markdown/streaming.js +41 -8
- package/components/xmarkdown/styles.js +2 -2
- package/components/xmarkdown/useXMarkdownDisplay.d.ts +1 -0
- package/components/xmarkdown/useXMarkdownDisplay.js +69 -24
- package/components/xmarkdown/xmarkdown.d.ts +3 -0
- package/components/xmarkdown/xmarkdown.vdt.js +6 -2
- package/dist/i18n/en-US.js +1 -0
- package/dist/i18n/en-US.js.map +1 -1
- package/dist/i18n/en-US.min.js +1 -1
- package/dist/index.js +795 -512
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/i18n/en-US.d.ts +1 -0
- package/i18n/en-US.js +1 -0
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ var _$tmp0 = {
|
|
|
10
10
|
'tabindex': '-1'
|
|
11
11
|
};
|
|
12
12
|
export default function ($props, $blocks, $__proto__) {
|
|
13
|
-
var _extends2;
|
|
13
|
+
var _extends2, _$cn2, _$cn3;
|
|
14
14
|
$blocks || ($blocks = {});
|
|
15
15
|
$props || ($props = {});
|
|
16
16
|
var $this = this;
|
|
@@ -19,6 +19,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
19
19
|
getRootStyle = _this$media.getRootStyle,
|
|
20
20
|
getFileName = _this$media.getFileName,
|
|
21
21
|
isLoading = _this$media.isLoading,
|
|
22
|
+
shouldShowVisualMediaContent = _this$media.shouldShowVisualMediaContent,
|
|
22
23
|
shouldShowImage = _this$media.shouldShowImage,
|
|
23
24
|
shouldShowVideo = _this$media.shouldShowVideo,
|
|
24
25
|
shouldShowAudioLoader = _this$media.shouldShowAudioLoader,
|
|
@@ -35,15 +36,18 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
35
36
|
getErrorCardAssetSrc = _this$media.getErrorCardAssetSrc,
|
|
36
37
|
getMediaCardIconStyle = _this$media.getMediaCardIconStyle,
|
|
37
38
|
shouldShowLoadingIndicator = _this$media.shouldShowLoadingIndicator,
|
|
39
|
+
shouldShowLoadingVideoIcon = _this$media.shouldShowLoadingVideoIcon,
|
|
38
40
|
shouldShowPlaceholder = _this$media.shouldShowPlaceholder,
|
|
39
41
|
getPreviewIconClassName = _this$media.getPreviewIconClassName,
|
|
40
42
|
getPlaceholderIconClassName = _this$media.getPlaceholderIconClassName,
|
|
43
|
+
getPlaceholderAssetSrc = _this$media.getPlaceholderAssetSrc,
|
|
41
44
|
getPreviewTitle = _this$media.getPreviewTitle,
|
|
42
45
|
onClick = _this$media.onClick,
|
|
43
46
|
onPreview = _this$media.onPreview,
|
|
44
47
|
canPreview = _this$media.canPreview,
|
|
45
48
|
shouldShowVideoPlayTrigger = _this$media.shouldShowVideoPlayTrigger,
|
|
46
49
|
shouldShowMaskLayer = _this$media.shouldShowMaskLayer,
|
|
50
|
+
shouldShowLoadingOverlay = _this$media.shouldShowLoadingOverlay,
|
|
47
51
|
getViewerItem = _this$media.getViewerItem,
|
|
48
52
|
getMaskValue = _this$media.getMaskValue,
|
|
49
53
|
isStandalonePreviewRendered = _this$media.isStandalonePreviewRendered,
|
|
@@ -87,6 +91,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
87
91
|
theme: 'light'
|
|
88
92
|
}, this.get('nameTooltipProps') || {});
|
|
89
93
|
var mediaName = getFileName();
|
|
94
|
+
var placeholderAssetSrc = getPlaceholderAssetSrc();
|
|
90
95
|
var audioCard = _$ce(2, 'div', _$ce(2, 'img', null, 1, _$cn(k + "-media-card-icon " + k + "-media-audio-card-icon"), {
|
|
91
96
|
'src': getAudioCardAssetSrc(),
|
|
92
97
|
'alt': '',
|
|
@@ -106,19 +111,25 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
106
111
|
'title': showNameTooltip ? undefined : getFileName()
|
|
107
112
|
}, getRestProps(this), {
|
|
108
113
|
'ev-click': onClick
|
|
109
|
-
}), [_$ce(2, 'div', [shouldShowImage() ? _$cv('img', _extends({
|
|
110
|
-
'className': _$cn(k + "-media-image"),
|
|
114
|
+
}), [_$ce(2, 'div', [shouldShowLoadingOverlay() && !showCustomLoadingLayer ? _$ce(2, 'div', null, 1, _$cn(k + "-media-loading-overlay")) : undefined, shouldShowImage() ? _$cv('img', _extends({
|
|
115
|
+
'className': _$cn((_$cn2 = {}, _$cn2[k + "-media-image"] = true, _$cn2[k + "-media-visual-hidden"] = !shouldShowVisualMediaContent(), _$cn2)),
|
|
111
116
|
'ref': imageRef
|
|
112
117
|
}, getImageProps())) : shouldShowVideo() ? _$cv('video', _extends({
|
|
113
118
|
'key': getVideoKey(),
|
|
114
|
-
'className': _$cn(k + "-media-video"),
|
|
119
|
+
'className': _$cn((_$cn3 = {}, _$cn3[k + "-media-video"] = true, _$cn3[k + "-media-visual-hidden"] = !shouldShowVisualMediaContent(), _$cn3)),
|
|
115
120
|
'ref': videoRef
|
|
116
121
|
}, getVideoProps())) : undefined, shouldShowAudioLoader() ? _$cv('audio', _extends({
|
|
117
122
|
'className': _$cn(k + "-media-audio-loader"),
|
|
118
123
|
'ref': audioRef
|
|
119
|
-
}, getAudioLoaderProps())) : undefined, shouldShowErrorCard() && !showCustomErrorLayer ? errorCard : shouldShowAudioCard() && !showCustomStateLayer ? audioCard : shouldShowPlaceholder() && !showCustomLoadingLayer && !showCustomErrorLayer ? _$ce(2, 'div', _$
|
|
124
|
+
}, getAudioLoaderProps())) : undefined, shouldShowErrorCard() && !showCustomErrorLayer ? errorCard : shouldShowAudioCard() && !showCustomStateLayer ? audioCard : shouldShowPlaceholder() && !showCustomLoadingLayer && !showCustomErrorLayer ? _$ce(2, 'div', placeholderAssetSrc ? _$ce(2, 'img', null, 1, _$cn(k + "-media-placeholder-asset"), {
|
|
125
|
+
'src': placeholderAssetSrc,
|
|
126
|
+
'alt': '',
|
|
127
|
+
'draggable': false
|
|
128
|
+
}) : _$cc(Icon, {
|
|
120
129
|
'className': _$cn(getPlaceholderIconClassName())
|
|
121
|
-
}), 2, _$cn(k + "-media-placeholder")) : undefined, shouldShowLoadingIndicator() && !showCustomLoadingLayer ? _$ce(2, 'div', _$ce(2, 'span', null, 1, _$cn(k + "-media-loading-spinner")), 2, _$cn(k + "-media-loading-indicator")) : undefined,
|
|
130
|
+
}), 2, _$cn(k + "-media-placeholder")) : undefined, shouldShowLoadingIndicator() && !showCustomLoadingLayer ? _$ce(2, 'div', _$ce(2, 'span', null, 1, _$cn(k + "-media-loading-spinner")), 2, _$cn(k + "-media-loading-indicator")) : undefined, shouldShowLoadingVideoIcon() && !showCustomLoadingLayer ? _$cc(Icon, {
|
|
131
|
+
'className': _$cn(k + "-media-loading-video-icon ion-ios-play")
|
|
132
|
+
}) : undefined, showNameTooltip ? _$cc(Tooltip, _extends({
|
|
122
133
|
'className': _$cn(k + "-media-name-tooltip")
|
|
123
134
|
}, nameTooltipProps, {
|
|
124
135
|
'children': _$ce(2, 'div', null, 1, _$cn(k + "-media-name-tooltip-trigger"), _$tmp0),
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare const mediaAudioCardUrl: string;
|
|
2
|
+
export declare const mediaImagePlaceholderUrl: string;
|
|
3
|
+
export declare const mediaVideoPlaceholderUrl: string;
|
|
2
4
|
export declare const mediaImageCardErrorUrl: string;
|
|
3
5
|
export declare const mediaVideoCardErrorUrl: string;
|
|
4
6
|
export declare const mediaAudioCardErrorUrl: string;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// 资源内联,避免框架包构建时依赖额外图片文件复制。
|
|
2
2
|
var mediaAudioCardSvg = ['<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">', '<g clip-path="url(#clip0_24923_23617)">', '<path d="M1.19995 2.4C1.19995 1.07452 2.27447 0 3.59995 0H14.4017L22.8 8.39355V21.6C22.8 22.9255 21.7254 24 20.4 24H3.59995C2.27447 24 1.19995 22.9255 1.19995 21.6V2.4Z" fill="url(#paint0_linear_24923_23617)"/>', '<path d="M15.7916 10.2829C15.1728 10.2829 14.5793 10.037 14.1417 9.59944C13.7041 9.16185 13.4583 8.56836 13.4583 7.94952H12.2916V13.6429C11.805 13.3177 11.2236 13.1645 10.64 13.2076C10.0563 13.2507 9.50381 13.4876 9.07021 13.8807C8.63661 14.2738 8.3468 14.8005 8.24683 15.3771C8.14687 15.9537 8.24247 16.5473 8.51845 17.0634C8.79444 17.5794 9.23497 17.9885 9.77007 18.2255C10.3052 18.4626 10.9041 18.514 11.4718 18.3716C12.0395 18.2293 12.5433 17.9013 12.9032 17.4398C13.2631 16.9783 13.4585 16.4098 13.4583 15.8245V10.5541C14.0993 11.1296 14.9301 11.4484 15.7916 11.4495V10.2829Z" fill="white"/>', '<g filter="url(#filter0_f_24923_23617)">', '<path d="M13.8 0L22.8 9H16.2C14.8746 9 13.8 7.92548 13.8 6.6V0Z" fill="#FA655E"/>', '</g>', '<path d="M14.3999 0L22.7999 8.4H16.7999C15.4744 8.4 14.3999 7.32548 14.3999 6V0Z" fill="#FEC6C2"/>', '</g>', '<defs>', '<filter id="filter0_f_24923_23617" x="10.8" y="-3" width="15" height="15" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">', '<feFlood flood-opacity="0" result="BackgroundImageFix"/>', '<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>', '<feGaussianBlur stdDeviation="1.5" result="effect1_foregroundBlur_24923_23617"/>', '</filter>', '<linearGradient id="paint0_linear_24923_23617" x1="1.19995" y1="0" x2="25.2" y2="24" gradientUnits="userSpaceOnUse">', '<stop stop-color="#FDA79C"/>', '<stop offset="1" stop-color="#FF8787"/>', '</linearGradient>', '<clipPath id="clip0_24923_23617">', '<rect width="24" height="24" fill="white"/>', '</clipPath>', '</defs>', '</svg>'].join('');
|
|
3
3
|
export var mediaAudioCardUrl = "data:image/svg+xml;charset=UTF-8," + encodeURIComponent(mediaAudioCardSvg);
|
|
4
|
+
var mediaImagePlaceholderSvg = ['<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">', '<path d="M4.5 7C5.32842 7 6 6.32842 6 5.5C6 4.67158 5.32842 4 4.5 4C3.67158 4 3 4.67158 3 5.5C3 6.32842 3.67158 7 4.5 7Z" fill="#C2C2CA"/>', '<path d="M8.90229 7.24208C9.17247 6.91269 9.7174 6.9208 9.9756 7.25809L12.8799 11.0521C13.1859 11.4518 12.8719 12 12.3369 12H5L8.90229 7.24208Z" fill="#C2C2CA" stroke="#C2C2CA" stroke-linecap="round" stroke-linejoin="round"/>', '<rect x="1" y="3" width="13" height="9" rx="1" stroke="#C2C2CA" stroke-linejoin="round"/>', '</svg>'].join('');
|
|
5
|
+
export var mediaImagePlaceholderUrl = "data:image/svg+xml;charset=UTF-8," + encodeURIComponent(mediaImagePlaceholderSvg);
|
|
6
|
+
var mediaVideoPlaceholderSvg = ['<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">', '<path d="M1.33282 4.4165C1.33282 3.86422 1.78054 3.4165 2.33282 3.4165H9.98913C10.5414 3.4165 10.9891 3.86422 10.9891 4.4165V11.5833C10.9891 12.1356 10.5414 12.5833 9.98913 12.5833H2.33282C1.78054 12.5833 1.33282 12.1356 1.33282 11.5833V4.4165Z" fill="#C2C2CA" stroke="#C2C2CA" stroke-linecap="square"/>', '<path d="M14 4.40059V11.5827C14 11.7506 13.8056 11.8438 13.6747 11.7386L11 9.58943V6.25554L13.6798 4.24073C13.8116 4.14163 14 4.23567 14 4.40059Z" fill="#C2C2CA" stroke="#C2C2CA" stroke-linecap="square"/>', '<path d="M8.8 5C8.91046 5 9 5.08954 9 5.2V5.8C9 5.91046 8.91046 6 8.8 6H5.2C5.08954 6 5 5.91046 5 5.8V5.2C5 5.08954 5.08954 5 5.2 5H8.8Z" fill="white"/>', '</svg>'].join('');
|
|
7
|
+
export var mediaVideoPlaceholderUrl = "data:image/svg+xml;charset=UTF-8," + encodeURIComponent(mediaVideoPlaceholderSvg);
|
|
4
8
|
var mediaImageCardErrorSvg = ['<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">', '<g clip-path="url(#clip0_25770_6783)">', '<path d="M1.6001 3.2C1.6001 1.43269 3.03279 0 4.8001 0H19.2024L30.4001 11.1914V28.8C30.4001 30.5673 28.9674 32 27.2001 32H4.8001C3.03279 32 1.6001 30.5673 1.6001 28.8V3.2Z" fill="url(#paint0_linear_25770_6783)"/>', '<path d="M8.24289 22.3474L11.1107 18.1323C11.1475 18.0783 11.1956 18.033 11.2518 17.9996C11.3079 17.9663 11.3707 17.9457 11.4357 17.9393C11.5007 17.9329 11.5664 17.9408 11.628 17.9626C11.6895 17.9844 11.7456 18.0194 11.7921 18.0652L13.6875 19.9222L17.8459 13.4042C17.8871 13.3395 17.9442 13.2865 18.0119 13.2504C18.0795 13.2142 18.1553 13.1961 18.232 13.1979C18.3086 13.1996 18.3835 13.2211 18.4495 13.2602C18.5154 13.2993 18.5701 13.3548 18.6084 13.4213L23.7752 22.3756C23.8144 22.4434 23.8351 22.5203 23.8351 22.5986C23.8352 22.6769 23.8146 22.7539 23.7754 22.8217C23.7362 22.8896 23.6799 22.9459 23.612 22.985C23.5441 23.0241 23.4672 23.0447 23.3888 23.0446H8.61173C8.53054 23.0447 8.45085 23.0227 8.38126 22.9809C8.31167 22.9391 8.25481 22.8791 8.21683 22.8074C8.17885 22.7356 8.16118 22.6548 8.16574 22.5738C8.1703 22.4927 8.19691 22.4145 8.2427 22.3474H8.24289Z" fill="white"/>', '<path d="M9.10168 12.8034C9.10168 13.3996 9.33855 13.9715 9.76017 14.3931C10.1818 14.8147 10.7536 15.0516 11.3499 15.0516C11.9462 15.0516 12.518 14.8147 12.9396 14.3931C13.3612 13.9715 13.5981 13.3996 13.5981 12.8034C13.5981 12.2071 13.3612 11.6353 12.9396 11.2137C12.518 10.792 11.9462 10.5552 11.3499 10.5552C10.7536 10.5552 10.1818 10.792 9.76017 11.2137C9.33855 11.6353 9.10168 12.2071 9.10168 12.8034Z" fill="white"/>', '<g filter="url(#filter0_f_25770_6783)">', '<path d="M18.4001 0L30.4001 12H21.6001C19.8328 12 18.4001 10.5673 18.4001 8.8V0Z" fill="#C9CAD6"/>', '</g>', '<path d="M19.2001 0L30.4001 11.2H22.4001C20.6328 11.2 19.2001 9.76731 19.2001 8V0Z" fill="#F2F2F3"/>', '</g>', '<defs>', '<filter id="filter0_f_25770_6783" x="14.4001" y="-4" width="20" height="20" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">', '<feFlood flood-opacity="0" result="BackgroundImageFix"/>', '<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>', '<feGaussianBlur stdDeviation="2" result="effect1_foregroundBlur_25770_6783"/>', '</filter>', '<linearGradient id="paint0_linear_25770_6783" x1="1.6001" y1="0" x2="33.6001" y2="32" gradientUnits="userSpaceOnUse">', '<stop stop-color="#ECECEC"/>', '<stop offset="1" stop-color="#D6DCE7"/>', '</linearGradient>', '<clipPath id="clip0_25770_6783">', '<rect width="32" height="32" fill="white"/>', '</clipPath>', '</defs>', '</svg>'].join('');
|
|
5
9
|
export var mediaImageCardErrorUrl = "data:image/svg+xml;charset=UTF-8," + encodeURIComponent(mediaImageCardErrorSvg);
|
|
6
10
|
var mediaVideoCardErrorSvg = ['<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">', '<g clip-path="url(#clip0_25770_6789)">', '<path d="M1.6001 3.2C1.6001 1.43269 3.03279 0 4.8001 0H19.2024L30.4001 11.1914V28.8C30.4001 30.5673 28.9674 32 27.2001 32H4.8001C3.03279 32 1.6001 30.5673 1.6001 28.8V3.2Z" fill="url(#paint0_linear_25770_6789)"/>', '<path d="M13.4815 12.9907C13.2152 12.8215 12.8669 13.0128 12.8669 13.3283V21.8719C12.8669 22.1874 13.2152 22.3787 13.4815 22.2095L20.2025 17.9377C20.4497 17.7805 20.4497 17.4197 20.2025 17.2625L13.4815 12.9907Z" fill="white"/>', '<g filter="url(#filter0_f_25770_6789)">', '<path d="M18.4001 0L30.4001 12H21.6001C19.8328 12 18.4001 10.5673 18.4001 8.8V0Z" fill="#C9CAD6"/>', '</g>', '<path d="M19.2001 0L30.4001 11.2H22.4001C20.6328 11.2 19.2001 9.76731 19.2001 8V0Z" fill="#F2F2F3"/>', '</g>', '<defs>', '<filter id="filter0_f_25770_6789" x="14.4001" y="-4" width="20" height="20" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">', '<feFlood flood-opacity="0" result="BackgroundImageFix"/>', '<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>', '<feGaussianBlur stdDeviation="2" result="effect1_foregroundBlur_25770_6789"/>', '</filter>', '<linearGradient id="paint0_linear_25770_6789" x1="1.6001" y1="0" x2="33.6001" y2="32" gradientUnits="userSpaceOnUse">', '<stop stop-color="#ECECEC"/>', '<stop offset="1" stop-color="#D6DCE7"/>', '</linearGradient>', '<clipPath id="clip0_25770_6789">', '<rect width="32" height="32" fill="white"/>', '</clipPath>', '</defs>', '</svg>'].join('');
|
|
@@ -13,11 +13,13 @@ var defaults = {
|
|
|
13
13
|
},
|
|
14
14
|
placeholderBg: 'linear-gradient(180deg, #F5F7FA 0%, #ECEFF4 100%)',
|
|
15
15
|
placeholderColor: '#98A0AF',
|
|
16
|
-
audioCardBg: '#
|
|
16
|
+
audioCardBg: '#F3F5F6',
|
|
17
17
|
audioCardTextColor: '#3A3D52',
|
|
18
18
|
overlayBg: 'rgba(15, 23, 42, 0.42)',
|
|
19
19
|
errorTextColor: theme.color.danger,
|
|
20
|
-
loadingSpinnerColor
|
|
20
|
+
get loadingSpinnerColor() {
|
|
21
|
+
return theme.color.primary;
|
|
22
|
+
},
|
|
21
23
|
loadingSkeletonBase: '#EEF1F5',
|
|
22
24
|
loadingSkeletonTo: '#F7F9FC',
|
|
23
25
|
groupGap: '12px',
|
|
@@ -42,7 +44,7 @@ setDefault(function () {
|
|
|
42
44
|
makeMediaViewerStyles == null || makeMediaViewerStyles.clearCache();
|
|
43
45
|
});
|
|
44
46
|
export var makeMediaStyles = cache(function makeMediaStyles(k) {
|
|
45
|
-
return /*#__PURE__*/css("&.", k, "-media{position:relative;display:inline-flex;flex:0 0 auto;width:", media.sizes.default, ";height:", media.sizes.default, ";vertical-align:top;box-sizing:border-box;}&.", k, "-media.", k, "-media-mini{width:", media.sizes.mini, ";height:", media.sizes.mini, ";}&.", k, "-media.", k, "-media-small{width:", media.sizes.small, ";height:", media.sizes.small, ";}&.", k, "-media.", k, "-media-large{width:", media.sizes.large, ";height:", media.sizes.large, ";}.", k, "-media-shell{position:relative;width:100%;height:100%;overflow:hidden;border-radius:", media.radius, ";background:", media.placeholderBg, ";box-shadow:inset 0 0 0 1px ", setAlpha('#111827', 0.08), ";}&.", k, "-media-loading .", k, "-media-shell{background:linear-gradient(\n 90deg,\n ", media.loadingSkeletonBase, " 25%,\n ", media.loadingSkeletonTo, " 37%,\n ", media.loadingSkeletonBase, " 63%\n );background-size:400% 100%;animation:", k, "-media-loading-wave 1.4s ease infinite;box-shadow:none;}&.", k, "-media-error .", k, "-media-shell,&.", k, "-media-custom-error .", k, "-media-shell{box-shadow:none;}&.", k, "-media-loading .", k, "-media-shell::before{content:none;}@keyframes ", k, "-media-loading-wave{0%{background-position:100% 50%;}100%{background-position:0 50%;}}.", k, "-media-image,.", k, "-media-video{position:relative;z-index:1;display:block;width:100%;height:100%;object-fit:cover;background:#DCE1E9;}&.", k, "-media-loading .", k, "-media-image,&.", k, "-media-loading .", k, "-media-video{background:transparent;}.", k, "-media-audio-loader{display:none;}.", k, "-media-audio-card,.", k, "-media-error-card{position:absolute;inset:0;z-index:1;display:flex;align-items:center;justify-content:center;background:", media.audioCardBg, ";box-sizing:border-box;}.", k, "-media-card-icon{display:block;width:32px;height:32px;flex:0 0 auto;}.", k, "-media-name-tooltip-content{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.", k, "-media-name-tooltip-trigger{position:absolute;inset:0;z-index:2;outline:none;}&.", k, "-media.", k, "-media-mini .", k, "-media-card-icon{width:24px;height:24px;}
|
|
47
|
+
return /*#__PURE__*/css("&.", k, "-media{position:relative;display:inline-flex;flex:0 0 auto;width:", media.sizes.default, ";height:", media.sizes.default, ";vertical-align:top;box-sizing:border-box;}&.", k, "-media.", k, "-media-mini{width:", media.sizes.mini, ";height:", media.sizes.mini, ";}&.", k, "-media.", k, "-media-small{width:", media.sizes.small, ";height:", media.sizes.small, ";}&.", k, "-media.", k, "-media-large{width:", media.sizes.large, ";height:", media.sizes.large, ";}.", k, "-media-shell{position:relative;width:100%;height:100%;overflow:hidden;border-radius:", media.radius, ";background:", media.placeholderBg, ";box-shadow:inset 0 0 0 1px ", setAlpha('#111827', 0.08), ";}&.", k, "-media-loading .", k, "-media-shell{background:linear-gradient(\n 90deg,\n ", media.loadingSkeletonBase, " 25%,\n ", media.loadingSkeletonTo, " 37%,\n ", media.loadingSkeletonBase, " 63%\n );background-size:400% 100%;animation:", k, "-media-loading-wave 1.4s ease infinite;box-shadow:none;}&.", k, "-media-error .", k, "-media-shell,&.", k, "-media-custom-error .", k, "-media-shell{box-shadow:none;}&.", k, "-media-loading .", k, "-media-shell::before{content:none;}@keyframes ", k, "-media-loading-wave{0%{background-position:100% 50%;}100%{background-position:0 50%;}}.", k, "-media-image,.", k, "-media-video{position:relative;z-index:1;display:block;width:100%;height:100%;object-fit:cover;background:#DCE1E9;}&.", k, "-media-loading .", k, "-media-image,&.", k, "-media-loading .", k, "-media-video{background:transparent;}.", k, "-media-visual-hidden{display:none;}.", k, "-media-audio-loader{display:none;}.", k, "-media-audio-card,.", k, "-media-error-card{position:absolute;inset:0;z-index:1;display:flex;align-items:center;justify-content:center;background:", media.audioCardBg, ";box-sizing:border-box;}.", k, "-media-card-icon{display:block;width:32px;height:32px;flex:0 0 auto;}.", k, "-media-name-tooltip-content{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.", k, "-media-name-tooltip-trigger{position:absolute;inset:0;z-index:2;outline:none;}&.", k, "-media.", k, "-media-mini .", k, "-media-card-icon{width:24px;height:24px;}.", k, "-media-error-card{background:transparent;}.", k, "-media-placeholder{position:absolute;inset:0;z-index:1;display:flex;align-items:center;justify-content:center;background:", media.placeholderBg, ";color:", media.placeholderColor, ";}.", k, "-media-placeholder .", k, "-icon{font-size:20px;}.", k, "-media-placeholder-asset{display:block;width:16px;height:16px;flex:0 0 auto;}&.", k, "-media-loading .", k, "-media-placeholder{background:transparent;}&.", k, "-media-mini .", k, "-media-placeholder .", k, "-icon,&.", k, "-media-small .", k, "-media-placeholder .", k, "-icon{font-size:16px;}.", k, "-media-overlay{position:absolute;inset:0;z-index:3;display:flex;align-items:center;justify-content:center;background:", media.overlayBg, ";opacity:0;pointer-events:none;transition:opacity ", theme.transition.middle, ";}.", k, "-media-loading-overlay{position:absolute;inset:0;z-index:2;background:", media.overlayBg, ";pointer-events:none;}.", k, "-media-preview-trigger,&.", k, "-media-custom-mask .", k, "-media-overlay{pointer-events:auto;}.", k, "-media-video-preview-trigger{position:absolute;inset:0;z-index:4;width:24px;height:24px;margin:auto;pointer-events:auto;}.", k, "-media-loading-indicator{position:absolute;top:3px;left:3px;z-index:3;display:flex;align-items:center;justify-content:center;width:14px;height:14px;pointer-events:none;}.", k, "-media-loading-spinner{width:12px;height:12px;border:1.5px solid ", setAlpha(media.loadingSpinnerColor, 0.22), ";border-top-color:", media.loadingSpinnerColor, ";border-radius:50%;box-sizing:border-box;animation:", k, "-media-loading-spinner 0.8s linear infinite;}.", k, "-media-loading-video-icon{position:absolute;inset:0;z-index:1;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;margin:auto;color:#FFFFFF;font-size:18px;line-height:1;pointer-events:none;}@keyframes ", k, "-media-loading-spinner{100%{transform:rotate(360deg);}}.", k, "-media-state-layer{position:absolute;inset:0;z-index:3;display:flex;align-items:center;justify-content:center;box-sizing:border-box;}.", k, "-media-preview-trigger{display:inline-flex;align-items:center;justify-content:center;width:auto;height:auto;padding:0;border:none;border-radius:0;background:transparent;color:#FFFFFF;cursor:pointer;transition:opacity ", theme.transition.middle, ";}.", k, "-media-preview-trigger:focus{outline:none;}.", k, "-media-preview-trigger .", k, "-icon,.", k, "-media-preview-trigger.ion{font-size:18px;}&.", k, "-media-mini .", k, "-media-preview-trigger .", k, "-icon,&.", k, "-media-small .", k, "-media-preview-trigger .", k, "-icon,&.", k, "-media-mini .", k, "-media-preview-trigger.ion,&.", k, "-media-small .", k, "-media-preview-trigger.ion{font-size:14px;}&.", k, "-media-mini .", k, "-media-video-preview-trigger,&.", k, "-media-small .", k, "-media-video-preview-trigger{width:18px;height:18px;}.", k, "-media-preview-trigger:hover:not(:disabled){background:transparent;}.", k, "-media-preview-trigger:disabled{opacity:0.5;cursor:not-allowed;}&.", k, "-media-mini .", k, "-media-loading-spinner,&.", k, "-media-small .", k, "-media-loading-spinner{width:10px;height:10px;border-width:1px;}&.", k, "-media-mini .", k, "-media-loading-indicator,&.", k, "-media-small .", k, "-media-loading-indicator{top:4px;left:4px;width:10px;height:10px;}&.", k, "-media-previewable:hover .", k, "-media-overlay{opacity:1;}&.", k, "-media-custom-mask:hover .", k, "-media-overlay{opacity:1;}&.", k, "-media-video-play-visible:hover .", k, "-media-overlay{opacity:1;}.", k, "-media-preview-icon.", k, "-icon,.", k, "-media-preview-icon.ion{color:inherit;}");
|
|
46
48
|
});
|
|
47
49
|
export var makeMediaGroupStyles = cache(function makeMediaGroupStyles(k) {
|
|
48
50
|
return /*#__PURE__*/css("&.", k, "-media-group{display:inline-flex;flex-wrap:wrap;gap:", media.groupGap, ";align-items:flex-start;max-width:100%;}");
|
|
@@ -12,6 +12,7 @@ export declare function useMedia(): {
|
|
|
12
12
|
isLoading: () => boolean;
|
|
13
13
|
isError: () => boolean;
|
|
14
14
|
isDone: () => boolean;
|
|
15
|
+
shouldShowVisualMediaContent: () => boolean;
|
|
15
16
|
shouldShowLoadingIndicator: () => boolean;
|
|
16
17
|
shouldShowImage: () => boolean;
|
|
17
18
|
shouldShowVideo: () => boolean;
|
|
@@ -55,8 +56,11 @@ export declare function useMedia(): {
|
|
|
55
56
|
width: string;
|
|
56
57
|
height: string;
|
|
57
58
|
} | undefined;
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
shouldShowLoadingOverlay: () => boolean;
|
|
60
|
+
shouldShowLoadingVideoIcon: () => boolean;
|
|
61
|
+
getPreviewIconClassName: () => "k-icon-visible" | "ion-ios-play";
|
|
62
|
+
getPlaceholderIconClassName: () => "" | "ion-ios-musical-note";
|
|
63
|
+
getPlaceholderAssetSrc: () => string;
|
|
60
64
|
getPreviewTitle: () => "播放视频" | "播放音频" | "查看图片";
|
|
61
65
|
onClick: (e: MouseEvent) => void;
|
|
62
66
|
onPreview: (e: any) => void;
|
|
@@ -3,7 +3,7 @@ import { createRef, nextTick, onMounted, onUnmounted, useInstance } from 'intact
|
|
|
3
3
|
import { useConfigContext } from '../config';
|
|
4
4
|
import { MediaGroupContext } from './context';
|
|
5
5
|
import { getMediaDisplayName, isNamedMediaSize, normalizeMediaLength, parseMediaPixelLength, resolveMediaType } from './mediaUtils';
|
|
6
|
-
import { mediaAudioCardErrorUrl, mediaAudioCardUrl, mediaImageCardErrorUrl, mediaVideoCardErrorUrl } from './mediaAssets';
|
|
6
|
+
import { mediaAudioCardErrorUrl, mediaAudioCardUrl, mediaImageCardErrorUrl, mediaImagePlaceholderUrl, mediaVideoCardErrorUrl, mediaVideoPlaceholderUrl } from './mediaAssets';
|
|
7
7
|
export function useMedia() {
|
|
8
8
|
var instance = useInstance();
|
|
9
9
|
var config = useConfigContext();
|
|
@@ -73,6 +73,9 @@ export function useMedia() {
|
|
|
73
73
|
function isDone() {
|
|
74
74
|
return getDisplayStatus() === 'done';
|
|
75
75
|
}
|
|
76
|
+
function isMediaReady() {
|
|
77
|
+
return getInternalStatus() === 'done' || isDone();
|
|
78
|
+
}
|
|
76
79
|
// 自定义遮罩层仅在 default/done 展示,避免与 loading/error 状态层冲突。
|
|
77
80
|
function shouldShowMaskLayer() {
|
|
78
81
|
var status = getDisplayStatus();
|
|
@@ -82,7 +85,7 @@ export function useMedia() {
|
|
|
82
85
|
return !!instance.get('showPreview') && hasSource() && isDone();
|
|
83
86
|
}
|
|
84
87
|
function shouldShowVideoPlayTrigger() {
|
|
85
|
-
return !!instance.get('showPreview') && shouldShowVideo();
|
|
88
|
+
return !!instance.get('showPreview') && shouldShowVideo() && isDone();
|
|
86
89
|
}
|
|
87
90
|
// 事件和插槽使用的公共媒体信息。
|
|
88
91
|
function getValue() {
|
|
@@ -147,6 +150,9 @@ export function useMedia() {
|
|
|
147
150
|
function shouldShowVideo() {
|
|
148
151
|
return getResolvedType() === 'video' && hasSource() && !isError();
|
|
149
152
|
}
|
|
153
|
+
function shouldShowVisualMediaContent() {
|
|
154
|
+
return isMediaReady();
|
|
155
|
+
}
|
|
150
156
|
function shouldShowAudioLoader() {
|
|
151
157
|
return getResolvedType() === 'audio' && hasSource() && !isError();
|
|
152
158
|
}
|
|
@@ -157,7 +163,7 @@ export function useMedia() {
|
|
|
157
163
|
return isError();
|
|
158
164
|
}
|
|
159
165
|
function shouldShowPlaceholder() {
|
|
160
|
-
return !shouldShowImage() && !shouldShowVideo() && !shouldShowErrorCard();
|
|
166
|
+
return (!shouldShowImage() || !shouldShowVisualMediaContent()) && (!shouldShowVideo() || !shouldShowVisualMediaContent()) && !shouldShowErrorCard();
|
|
161
167
|
}
|
|
162
168
|
// poster 是组件级视频封面,不从 videoProps 中读取。
|
|
163
169
|
function getPosterSource() {
|
|
@@ -203,6 +209,13 @@ export function useMedia() {
|
|
|
203
209
|
function shouldShowLoadingIndicator() {
|
|
204
210
|
return isLoading();
|
|
205
211
|
}
|
|
212
|
+
function shouldShowLoadingOverlay() {
|
|
213
|
+
var type = getResolvedType();
|
|
214
|
+
return isLoading() && hasSource() && shouldShowVisualMediaContent() && (type === 'image' || type === 'video');
|
|
215
|
+
}
|
|
216
|
+
function shouldShowLoadingVideoIcon() {
|
|
217
|
+
return isLoading() && getResolvedType() === 'video' && hasSource() && shouldShowVisualMediaContent();
|
|
218
|
+
}
|
|
206
219
|
// 去掉已被组件接管的事件键,避免作为普通 attribute 透传到 DOM。
|
|
207
220
|
function omitNativeHandlers(props, keys) {
|
|
208
221
|
var nextProps = _extends({}, props);
|
|
@@ -273,13 +286,18 @@ export function useMedia() {
|
|
|
273
286
|
});
|
|
274
287
|
}
|
|
275
288
|
function getPreviewIconClassName() {
|
|
276
|
-
return getResolvedType() === 'image' ? '
|
|
289
|
+
return getResolvedType() === 'image' ? 'k-icon-visible' : 'ion-ios-play';
|
|
277
290
|
}
|
|
278
291
|
function getPlaceholderIconClassName() {
|
|
279
292
|
var resolvedType = getResolvedType();
|
|
280
|
-
if (resolvedType === 'video') return 'ion-videocamera';
|
|
281
293
|
if (resolvedType === 'audio') return 'ion-ios-musical-note';
|
|
282
|
-
return '
|
|
294
|
+
return '';
|
|
295
|
+
}
|
|
296
|
+
function getPlaceholderAssetSrc() {
|
|
297
|
+
var resolvedType = getResolvedType();
|
|
298
|
+
if (resolvedType === 'video') return mediaVideoPlaceholderUrl;
|
|
299
|
+
if (resolvedType === 'image') return mediaImagePlaceholderUrl;
|
|
300
|
+
return '';
|
|
283
301
|
}
|
|
284
302
|
function getPreviewTitle() {
|
|
285
303
|
var resolvedType = getResolvedType();
|
|
@@ -438,6 +456,7 @@ export function useMedia() {
|
|
|
438
456
|
isLoading: isLoading,
|
|
439
457
|
isError: isError,
|
|
440
458
|
isDone: isDone,
|
|
459
|
+
shouldShowVisualMediaContent: shouldShowVisualMediaContent,
|
|
441
460
|
shouldShowLoadingIndicator: shouldShowLoadingIndicator,
|
|
442
461
|
shouldShowImage: shouldShowImage,
|
|
443
462
|
shouldShowVideo: shouldShowVideo,
|
|
@@ -455,8 +474,11 @@ export function useMedia() {
|
|
|
455
474
|
getAudioCardAssetSrc: getAudioCardAssetSrc,
|
|
456
475
|
getErrorCardAssetSrc: getErrorCardAssetSrc,
|
|
457
476
|
getMediaCardIconStyle: getMediaCardIconStyle,
|
|
477
|
+
shouldShowLoadingOverlay: shouldShowLoadingOverlay,
|
|
478
|
+
shouldShowLoadingVideoIcon: shouldShowLoadingVideoIcon,
|
|
458
479
|
getPreviewIconClassName: getPreviewIconClassName,
|
|
459
480
|
getPlaceholderIconClassName: getPlaceholderIconClassName,
|
|
481
|
+
getPlaceholderAssetSrc: getPlaceholderAssetSrc,
|
|
460
482
|
getPreviewTitle: getPreviewTitle,
|
|
461
483
|
onClick: onClick,
|
|
462
484
|
onPreview: onPreview,
|