@tarojs/components 3.3.12 → 3.4.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/dist/cjs/{index-cf56824f.js → index-b9715722.js} +1 -1
- package/dist/cjs/{index-eefce54e.js → index-dd4b7ba3.js} +156 -101
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/taro-audio-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-block-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-button-core.cjs.entry.js +3 -3
- package/dist/cjs/taro-camera-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-canvas-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-checkbox-core_2.cjs.entry.js +6 -5
- package/dist/cjs/taro-components.cjs.js +5 -5
- package/dist/cjs/taro-cover-image-core.cjs.entry.js +19 -5
- package/dist/cjs/taro-cover-view-core.cjs.entry.js +51 -5
- package/dist/cjs/taro-custom-wrapper-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-form-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-icon-core.cjs.entry.js +3 -3
- package/dist/cjs/taro-image-core.cjs.entry.js +3 -3
- package/dist/cjs/taro-input-core.cjs.entry.js +21 -13
- package/dist/cjs/taro-label-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-movable-area-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-movable-view-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-navigator-core.cjs.entry.js +3 -3
- package/dist/cjs/taro-open-data-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-picker-core_2.cjs.entry.js +4 -4
- package/dist/cjs/taro-picker-view-column-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-picker-view-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-progress-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-pull-to-refresh.cjs.entry.js +3 -3
- package/dist/cjs/taro-radio-core_2.cjs.entry.js +3 -3
- package/dist/cjs/taro-rich-text-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-scroll-view-core.cjs.entry.js +3 -3
- package/dist/cjs/taro-slider-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-swiper-core_2.cjs.entry.js +112 -106
- package/dist/cjs/taro-switch-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-tabbar.cjs.entry.js +69 -23
- package/dist/cjs/taro-text-core.cjs.entry.js +3 -3
- package/dist/cjs/taro-textarea-core.cjs.entry.js +65 -5
- package/dist/cjs/taro-video-control_3.cjs.entry.js +186 -103
- package/dist/cjs/taro-view-core.cjs.entry.js +11 -3
- package/dist/cjs/taro-web-view-core.cjs.entry.js +2 -2
- package/dist/collection/collection-manifest.json +3 -3
- package/dist/collection/components/checkbox/checkbox.js +21 -2
- package/dist/collection/components/cover-image/cover-image.js +94 -0
- package/dist/collection/components/cover-image/style/index.css +5 -0
- package/dist/collection/components/cover-view/cover-view.js +166 -4
- package/dist/collection/components/cover-view/style/cover-view.css +3 -0
- package/dist/collection/components/input/input.js +19 -11
- package/dist/collection/components/swiper/swiper.js +7 -1
- package/dist/collection/components/tabbar/tabbar.js +70 -20
- package/dist/collection/components/textarea/style/index.css +6 -2
- package/dist/collection/components/textarea/textarea.js +98 -3
- package/dist/collection/components/video/video-control.js +39 -22
- package/dist/collection/components/video/video-danmu.js +52 -39
- package/dist/collection/components/video/video.js +60 -37
- package/dist/collection/components/view/view.js +9 -1
- package/dist/esm/{index-ff1b322a.js → index-3c78bcaf.js} +1 -1
- package/dist/esm/{index-310de3d5.js → index-5bd7cbab.js} +156 -101
- package/dist/esm/loader.js +3 -3
- package/dist/esm/taro-audio-core.entry.js +2 -2
- package/dist/esm/taro-block-core.entry.js +2 -2
- package/dist/esm/taro-button-core.entry.js +3 -3
- package/dist/esm/taro-camera-core.entry.js +2 -2
- package/dist/esm/taro-canvas-core.entry.js +2 -2
- package/dist/esm/taro-checkbox-core_2.entry.js +6 -5
- package/dist/esm/taro-components.js +5 -5
- package/dist/esm/taro-cover-image-core.entry.js +19 -5
- package/dist/esm/taro-cover-view-core.entry.js +51 -5
- package/dist/esm/taro-custom-wrapper-core.entry.js +2 -2
- package/dist/esm/taro-form-core.entry.js +2 -2
- package/dist/esm/taro-icon-core.entry.js +3 -3
- package/dist/esm/taro-image-core.entry.js +3 -3
- package/dist/esm/taro-input-core.entry.js +21 -13
- package/dist/esm/taro-label-core.entry.js +2 -2
- package/dist/esm/taro-movable-area-core.entry.js +2 -2
- package/dist/esm/taro-movable-view-core.entry.js +2 -2
- package/dist/esm/taro-navigator-core.entry.js +3 -3
- package/dist/esm/taro-open-data-core.entry.js +2 -2
- package/dist/esm/taro-picker-core_2.entry.js +4 -4
- package/dist/esm/taro-picker-view-column-core.entry.js +2 -2
- package/dist/esm/taro-picker-view-core.entry.js +2 -2
- package/dist/esm/taro-progress-core.entry.js +2 -2
- package/dist/esm/taro-pull-to-refresh.entry.js +3 -3
- package/dist/esm/taro-radio-core_2.entry.js +3 -3
- package/dist/esm/taro-rich-text-core.entry.js +2 -2
- package/dist/esm/taro-scroll-view-core.entry.js +3 -3
- package/dist/esm/taro-slider-core.entry.js +2 -2
- package/dist/esm/taro-swiper-core_2.entry.js +112 -106
- package/dist/esm/taro-switch-core.entry.js +2 -2
- package/dist/esm/taro-tabbar.entry.js +69 -23
- package/dist/esm/taro-text-core.entry.js +3 -3
- package/dist/esm/taro-textarea-core.entry.js +65 -5
- package/dist/esm/taro-video-control_3.entry.js +186 -103
- package/dist/esm/taro-view-core.entry.js +11 -3
- package/dist/esm/taro-web-view-core.entry.js +2 -2
- package/dist/esm-es5/{index-ff1b322a.js → index-3c78bcaf.js} +0 -0
- package/dist/esm-es5/index-5bd7cbab.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/taro-audio-core.entry.js +1 -1
- package/dist/esm-es5/taro-block-core.entry.js +1 -1
- package/dist/esm-es5/taro-button-core.entry.js +1 -1
- package/dist/esm-es5/taro-camera-core.entry.js +1 -1
- package/dist/esm-es5/taro-canvas-core.entry.js +1 -1
- package/dist/esm-es5/taro-checkbox-core_2.entry.js +1 -1
- package/dist/esm-es5/taro-components.js +1 -1
- package/dist/esm-es5/taro-cover-image-core.entry.js +1 -1
- package/dist/esm-es5/taro-cover-view-core.entry.js +1 -1
- package/dist/esm-es5/taro-custom-wrapper-core.entry.js +1 -1
- package/dist/esm-es5/taro-form-core.entry.js +1 -1
- package/dist/esm-es5/taro-icon-core.entry.js +1 -1
- package/dist/esm-es5/taro-image-core.entry.js +1 -1
- package/dist/esm-es5/taro-input-core.entry.js +1 -1
- package/dist/esm-es5/taro-label-core.entry.js +1 -1
- package/dist/esm-es5/taro-movable-area-core.entry.js +1 -1
- package/dist/esm-es5/taro-movable-view-core.entry.js +1 -1
- package/dist/esm-es5/taro-navigator-core.entry.js +1 -1
- package/dist/esm-es5/taro-open-data-core.entry.js +1 -1
- package/dist/esm-es5/taro-picker-core_2.entry.js +1 -1
- package/dist/esm-es5/taro-picker-view-column-core.entry.js +1 -1
- package/dist/esm-es5/taro-picker-view-core.entry.js +1 -1
- package/dist/esm-es5/taro-progress-core.entry.js +1 -1
- package/dist/esm-es5/taro-pull-to-refresh.entry.js +1 -1
- package/dist/esm-es5/taro-radio-core_2.entry.js +1 -1
- package/dist/esm-es5/taro-rich-text-core.entry.js +1 -1
- package/dist/esm-es5/taro-scroll-view-core.entry.js +1 -1
- package/dist/esm-es5/taro-slider-core.entry.js +1 -1
- package/dist/esm-es5/taro-swiper-core_2.entry.js +1 -1
- package/dist/esm-es5/taro-switch-core.entry.js +1 -1
- package/dist/esm-es5/taro-tabbar.entry.js +1 -1
- package/dist/esm-es5/taro-text-core.entry.js +1 -1
- package/dist/esm-es5/taro-textarea-core.entry.js +1 -1
- package/dist/esm-es5/taro-video-control_3.entry.js +1 -1
- package/dist/esm-es5/taro-view-core.entry.js +1 -1
- package/dist/esm-es5/taro-web-view-core.entry.js +1 -1
- package/dist/taro-components/p-06bffead.entry.js +1 -0
- package/dist/taro-components/{p-0f393c6d.system.entry.js → p-10a6c489.system.entry.js} +1 -1
- package/dist/taro-components/p-11932905.entry.js +1 -0
- package/dist/taro-components/p-12638ebc.system.entry.js +1 -0
- package/dist/taro-components/p-12ae0a33.entry.js +1 -0
- package/dist/taro-components/{p-4f139925.system.entry.js → p-13c1404f.system.entry.js} +1 -1
- package/dist/taro-components/{p-81f5977d.system.entry.js → p-17039974.system.entry.js} +1 -1
- package/dist/taro-components/p-17cf8b5b.entry.js +1 -0
- package/dist/taro-components/{p-9242dcf7.system.entry.js → p-1b790eb0.system.entry.js} +1 -1
- package/dist/taro-components/{p-a079321f.system.entry.js → p-1e4f1702.system.entry.js} +1 -1
- package/dist/taro-components/{p-8eb84de2.system.entry.js → p-264b7229.system.entry.js} +1 -1
- package/dist/taro-components/p-33ee636a.system.js +1 -0
- package/dist/taro-components/p-3633bb84.entry.js +1 -0
- package/dist/taro-components/{p-239bf0ca.system.entry.js → p-3643d8f7.system.entry.js} +1 -1
- package/dist/taro-components/{p-625158f0.js → p-37cfdd8f.js} +0 -0
- package/dist/taro-components/{p-15121391.system.entry.js → p-3aac5746.system.entry.js} +1 -1
- package/dist/taro-components/{p-a74d5aa5.system.entry.js → p-3eebeb1c.system.entry.js} +1 -1
- package/dist/taro-components/p-431197bc.entry.js +1 -0
- package/dist/taro-components/{p-1f2dfaef.system.entry.js → p-43de2f12.system.entry.js} +1 -1
- package/dist/taro-components/{p-d402dc94.system.entry.js → p-46cf6431.system.entry.js} +1 -1
- package/dist/taro-components/p-4dbed323.entry.js +1 -0
- package/dist/taro-components/{p-129341f2.system.entry.js → p-50066d5e.system.entry.js} +1 -1
- package/dist/taro-components/p-554e1039.entry.js +1 -0
- package/dist/taro-components/p-55b0a30b.entry.js +1 -0
- package/dist/taro-components/p-5c420456.entry.js +1 -0
- package/dist/taro-components/p-5f8b5f62.entry.js +1 -0
- package/dist/taro-components/p-627a5064.system.entry.js +1 -0
- package/dist/taro-components/{p-89fc30f0.entry.js → p-64993f48.entry.js} +1 -1
- package/dist/taro-components/p-66237ac0.entry.js +1 -0
- package/dist/taro-components/p-6965567d.entry.js +1 -0
- package/dist/taro-components/{p-9c9178cd.system.entry.js → p-703dfad8.system.entry.js} +1 -1
- package/dist/taro-components/p-71de9bd6.entry.js +1 -0
- package/dist/taro-components/p-74540410.entry.js +1 -0
- package/dist/taro-components/p-7a64a3d2.entry.js +1 -0
- package/dist/taro-components/{p-9a4123eb.system.entry.js → p-7d848382.system.entry.js} +1 -1
- package/dist/taro-components/p-83dedaa2.entry.js +1 -0
- package/dist/taro-components/p-865c21b5.entry.js +1 -0
- package/dist/taro-components/p-8a5e67cb.entry.js +1 -0
- package/dist/taro-components/p-8bc82aaa.entry.js +1 -0
- package/dist/taro-components/p-8db237e0.entry.js +1 -0
- package/dist/taro-components/{p-aed3d0e9.system.entry.js → p-8f90fca9.system.entry.js} +1 -1
- package/dist/taro-components/{p-bd00f506.system.js → p-94c20f60.system.js} +0 -0
- package/dist/taro-components/p-95529dc0.entry.js +1 -0
- package/dist/taro-components/p-964692f7.system.entry.js +1 -0
- package/dist/taro-components/p-99ed3ed2.system.entry.js +1 -0
- package/dist/taro-components/{p-4d11f3ad.system.entry.js → p-9a618935.system.entry.js} +1 -1
- package/dist/taro-components/p-9d0ab7c4.entry.js +1 -0
- package/dist/taro-components/{p-e3e40b03.system.entry.js → p-9fc88fc1.system.entry.js} +1 -1
- package/dist/taro-components/p-a1423df9.entry.js +1 -0
- package/dist/taro-components/p-ad16d1f2.system.entry.js +1 -0
- package/dist/taro-components/p-b2d01686.system.js +1 -0
- package/dist/taro-components/p-b75d8a65.entry.js +1 -0
- package/dist/taro-components/p-b8e0ad7d.entry.js +1 -0
- package/dist/taro-components/p-b9280444.entry.js +1 -0
- package/dist/taro-components/{p-236774f0.system.entry.js → p-bd3fa355.system.entry.js} +1 -1
- package/dist/taro-components/p-c218c298.entry.js +1 -0
- package/dist/taro-components/p-c362734b.entry.js +1 -0
- package/dist/taro-components/p-cea9a198.system.entry.js +1 -0
- package/dist/taro-components/{p-921a765a.system.entry.js → p-cfbdd4e3.system.entry.js} +1 -1
- package/dist/taro-components/p-d394a61f.system.entry.js +1 -0
- package/dist/taro-components/p-d567b95e.entry.js +1 -0
- package/dist/taro-components/p-d5971476.entry.js +1 -0
- package/dist/taro-components/{p-502841e0.system.entry.js → p-e0af1d0d.system.entry.js} +1 -1
- package/dist/taro-components/p-e27798a4.entry.js +1 -0
- package/dist/taro-components/p-e6298500.entry.js +1 -0
- package/dist/taro-components/{p-30c0639e.js → p-f05e1558.js} +1 -1
- package/dist/taro-components/{p-318795b9.system.entry.js → p-fb0959c1.system.entry.js} +1 -1
- package/dist/taro-components/{p-e15654c4.system.entry.js → p-fb2252b7.system.entry.js} +1 -1
- package/dist/taro-components/p-fc4939c6.system.entry.js +1 -0
- package/dist/taro-components/{p-3eb31172.system.entry.js → p-fd8312e5.system.entry.js} +1 -1
- package/dist/taro-components/{p-c1d6c0ba.system.entry.js → p-fdd73355.system.entry.js} +1 -1
- package/dist/taro-components/p-fde3a009.system.entry.js +1 -0
- package/dist/taro-components/p-fe156231.system.entry.js +1 -0
- package/dist/taro-components/p-ff017f01.entry.js +1 -0
- package/dist/taro-components/{p-970ed6da.system.entry.js → p-ffe63ce9.system.entry.js} +1 -1
- package/dist/taro-components/taro-components.esm.js +1 -1
- package/dist/taro-components/taro-components.js +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +1 -0
- package/dist/types/components/cover-image/cover-image.d.ts +11 -0
- package/dist/types/components/cover-view/cover-view.d.ts +14 -2
- package/dist/types/components/tabbar/tabbar.d.ts +20 -1
- package/dist/types/components/textarea/textarea.d.ts +6 -0
- package/dist/types/components/view/view.d.ts +2 -0
- package/dist/types/components.d.ts +20 -0
- package/dist/types/stencil-public-runtime.d.ts +190 -182
- package/dist-h5/vue/createComponent.js +4 -0
- package/dist-h5/vue/createFormsComponent.js +8 -1
- package/loader/index.d.ts +0 -1
- package/package.json +5 -5
- package/dist/collection/components/cover-view/cover-image.js +0 -11
- package/dist/esm-es5/index-310de3d5.js +0 -1
- package/dist/taro-components/p-180fd001.entry.js +0 -1
- package/dist/taro-components/p-28348261.entry.js +0 -1
- package/dist/taro-components/p-2e9e9ca7.system.entry.js +0 -1
- package/dist/taro-components/p-31b89eb3.entry.js +0 -1
- package/dist/taro-components/p-31f0f881.entry.js +0 -1
- package/dist/taro-components/p-4591dff5.entry.js +0 -1
- package/dist/taro-components/p-4afe24d7.entry.js +0 -1
- package/dist/taro-components/p-4b632069.entry.js +0 -1
- package/dist/taro-components/p-4f1d45ff.entry.js +0 -1
- package/dist/taro-components/p-5032d822.entry.js +0 -1
- package/dist/taro-components/p-593ee811.entry.js +0 -1
- package/dist/taro-components/p-6287057a.entry.js +0 -1
- package/dist/taro-components/p-66120099.entry.js +0 -1
- package/dist/taro-components/p-6730fa44.entry.js +0 -1
- package/dist/taro-components/p-6f331ed3.entry.js +0 -1
- package/dist/taro-components/p-73c389e7.system.entry.js +0 -1
- package/dist/taro-components/p-7911ccd6.system.entry.js +0 -1
- package/dist/taro-components/p-8031d6b5.system.entry.js +0 -1
- package/dist/taro-components/p-80f50da7.entry.js +0 -1
- package/dist/taro-components/p-82185d54.system.entry.js +0 -1
- package/dist/taro-components/p-8676c058.entry.js +0 -1
- package/dist/taro-components/p-8c43da73.system.entry.js +0 -1
- package/dist/taro-components/p-8f7b75f6.system.entry.js +0 -1
- package/dist/taro-components/p-906c3a0a.entry.js +0 -1
- package/dist/taro-components/p-9205470e.entry.js +0 -1
- package/dist/taro-components/p-945fa1a0.entry.js +0 -1
- package/dist/taro-components/p-95f5261c.entry.js +0 -1
- package/dist/taro-components/p-96771939.entry.js +0 -1
- package/dist/taro-components/p-96f1e9e7.entry.js +0 -1
- package/dist/taro-components/p-9c47f99e.entry.js +0 -1
- package/dist/taro-components/p-9fe2309f.entry.js +0 -1
- package/dist/taro-components/p-9ffb69e5.system.entry.js +0 -1
- package/dist/taro-components/p-a208926a.entry.js +0 -1
- package/dist/taro-components/p-a3e783c3.entry.js +0 -1
- package/dist/taro-components/p-af393b0b.entry.js +0 -1
- package/dist/taro-components/p-b2ed71a7.entry.js +0 -1
- package/dist/taro-components/p-b5d2597b.system.js +0 -1
- package/dist/taro-components/p-b7c29d05.entry.js +0 -1
- package/dist/taro-components/p-c2810ece.entry.js +0 -1
- package/dist/taro-components/p-c37d9a5d.system.entry.js +0 -1
- package/dist/taro-components/p-c9380fa6.entry.js +0 -1
- package/dist/taro-components/p-ca74a018.entry.js +0 -1
- package/dist/taro-components/p-cf496b3b.system.js +0 -1
- package/dist/taro-components/p-e256974b.system.entry.js +0 -1
- package/dist/taro-components/p-e28625a2.entry.js +0 -1
- package/dist/taro-components/p-e302b8d7.entry.js +0 -1
- package/dist/types/components/cover-view/cover-image.d.ts +0 -4
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
11
|
import { Component, h, Prop, Host, Element, Listen, Method } from '@stencil/core';
|
|
3
12
|
import { formatTime } from './utils';
|
|
@@ -42,32 +51,40 @@ export class VideoControl {
|
|
|
42
51
|
this.seekFunc(this.percentage * this.duration);
|
|
43
52
|
this.toggleVisibility(true);
|
|
44
53
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
this.progressBallRef
|
|
48
|
-
|
|
54
|
+
setProgressBall(percentage) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
if (this.progressBallRef) {
|
|
57
|
+
this.progressBallRef.style.left = `${percentage * 100}%`;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
49
60
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
this.
|
|
56
|
-
this.
|
|
57
|
-
|
|
61
|
+
toggleVisibility(nextVisible) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
const visible = nextVisible === undefined ? !this.visible : nextVisible;
|
|
64
|
+
if (visible) {
|
|
65
|
+
this.hideControlsTimer && clearTimeout(this.hideControlsTimer);
|
|
66
|
+
if (this.isPlaying) {
|
|
67
|
+
this.hideControlsTimer = setTimeout(() => {
|
|
68
|
+
this.toggleVisibility(false);
|
|
69
|
+
}, 2000);
|
|
70
|
+
}
|
|
71
|
+
this.controlsRef.style.visibility = 'visible';
|
|
58
72
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
this.
|
|
63
|
-
}
|
|
64
|
-
this.visible = !!visible;
|
|
73
|
+
else {
|
|
74
|
+
this.controlsRef.style.visibility = 'hidden';
|
|
75
|
+
}
|
|
76
|
+
this.visible = !!visible;
|
|
77
|
+
});
|
|
65
78
|
}
|
|
66
|
-
|
|
67
|
-
return this
|
|
79
|
+
getIsDraggingProgressBall() {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
return this.isDraggingProgressBall;
|
|
82
|
+
});
|
|
68
83
|
}
|
|
69
|
-
|
|
70
|
-
this
|
|
84
|
+
setCurrentTime(time) {
|
|
85
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
this.currentTimeRef.innerHTML = formatTime(time);
|
|
87
|
+
});
|
|
71
88
|
}
|
|
72
89
|
render() {
|
|
73
90
|
const { controls, currentTime, duration, isPlaying, pauseFunc, playFunc, showPlayBtn, showProgress } = this;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
11
|
import { Component, h, Prop, State, Host, Method } from '@stencil/core';
|
|
3
12
|
export class VideoDanmu {
|
|
@@ -17,47 +26,51 @@ export class VideoDanmu {
|
|
|
17
26
|
clonedDanmu.bottom = `${Math.random() * 90 + 5}%`;
|
|
18
27
|
return clonedDanmu;
|
|
19
28
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
async tick(currentTime) {
|
|
36
|
-
this.currentTime = currentTime;
|
|
37
|
-
if (!this.enable)
|
|
38
|
-
return;
|
|
39
|
-
const danmuList = this.list;
|
|
40
|
-
/**
|
|
41
|
-
* @todo 这个判断对拖拽进度的处理不严谨
|
|
42
|
-
*/
|
|
43
|
-
const newDanmuList = danmuList.filter(({ time }) => {
|
|
44
|
-
return currentTime - time < 4 && currentTime > time;
|
|
29
|
+
sendDanmu(danmuList = []) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
if (Array.isArray(danmuList)) {
|
|
32
|
+
this.list = [
|
|
33
|
+
...this.list,
|
|
34
|
+
...danmuList.map(danmu => this.ensureProperties(danmu))
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
const danmu = danmuList;
|
|
39
|
+
this.list = [
|
|
40
|
+
...this.list,
|
|
41
|
+
Object.assign({}, this.ensureProperties(danmu))
|
|
42
|
+
];
|
|
43
|
+
}
|
|
45
44
|
});
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
}
|
|
46
|
+
tick(currentTime) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
this.currentTime = currentTime;
|
|
49
|
+
if (!this.enable)
|
|
50
|
+
return;
|
|
51
|
+
const danmuList = this.list;
|
|
52
|
+
/**
|
|
53
|
+
* @todo 这个判断对拖拽进度的处理不严谨
|
|
54
|
+
*/
|
|
55
|
+
const newDanmuList = danmuList.filter(({ time }) => {
|
|
56
|
+
return currentTime - time < 4 && currentTime > time;
|
|
56
57
|
});
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
let shouldUpdate = false;
|
|
59
|
+
const oldDanmuList = this.danmuList;
|
|
60
|
+
if (newDanmuList.length !== oldDanmuList.length) {
|
|
61
|
+
shouldUpdate = true;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
shouldUpdate = newDanmuList.some(({ key }) => {
|
|
65
|
+
return oldDanmuList.every((danmu) => {
|
|
66
|
+
return key !== danmu.key;
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (shouldUpdate) {
|
|
71
|
+
this.danmuList = newDanmuList;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
61
74
|
}
|
|
62
75
|
componentDidUpdate() {
|
|
63
76
|
requestAnimationFrame(() => {
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
11
|
import { Component, h, Prop, State, Event, Host, Watch, Listen, Element, Method } from '@stencil/core';
|
|
3
12
|
import classNames from 'classnames';
|
|
@@ -141,11 +150,11 @@ export class Video {
|
|
|
141
150
|
this.controlsRef.toggleVisibility();
|
|
142
151
|
this.onEnded.emit();
|
|
143
152
|
};
|
|
144
|
-
this.handleTimeUpdate = throttle(
|
|
153
|
+
this.handleTimeUpdate = throttle((e) => __awaiter(this, void 0, void 0, function* () {
|
|
145
154
|
var _a, _b;
|
|
146
155
|
this.currentTime = this.videoRef.currentTime;
|
|
147
156
|
const duration = this.duration || this._duration;
|
|
148
|
-
const isControlDragging =
|
|
157
|
+
const isControlDragging = yield this.controlsRef.getIsDraggingProgressBall();
|
|
149
158
|
if (this.controls && this.showProgress) {
|
|
150
159
|
if (!isControlDragging && !this.isDraggingProgress) {
|
|
151
160
|
this.controlsRef.setProgressBall(this.currentTime / duration);
|
|
@@ -163,7 +172,7 @@ export class Video {
|
|
|
163
172
|
this.handleEnded();
|
|
164
173
|
}
|
|
165
174
|
}
|
|
166
|
-
}, 250);
|
|
175
|
+
}), 250);
|
|
167
176
|
this.handleError = e => {
|
|
168
177
|
var _a, _b;
|
|
169
178
|
this.onError.emit({
|
|
@@ -268,29 +277,31 @@ export class Video {
|
|
|
268
277
|
watchEnableDanmu(newVal) {
|
|
269
278
|
this._enableDanmu = newVal;
|
|
270
279
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
else if (gestureObj.type === 'adjustProgress') {
|
|
284
|
-
this.isDraggingProgress = true;
|
|
285
|
-
this.nextPercentage = Math.max(Math.min(this.lastPercentage + gestureObj.dataX, 1), 0);
|
|
286
|
-
if (this.controls && this.showProgress) {
|
|
287
|
-
this.controlsRef.setProgressBall(this.nextPercentage);
|
|
288
|
-
this.controlsRef.toggleVisibility(true);
|
|
280
|
+
onDocumentTouchMove(e) {
|
|
281
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
282
|
+
if (this.lastTouchScreenX === undefined || this.lastTouchScreenY === undefined)
|
|
283
|
+
return;
|
|
284
|
+
if (yield this.controlsRef.getIsDraggingProgressBall())
|
|
285
|
+
return;
|
|
286
|
+
const gestureObj = this.analyseGesture(e);
|
|
287
|
+
if (gestureObj.type === 'adjustVolume') {
|
|
288
|
+
this.toastVolumeRef.style.visibility = 'visible';
|
|
289
|
+
const nextVolume = Math.max(Math.min(this.lastVolume - gestureObj.dataY, 1), 0);
|
|
290
|
+
this.videoRef.volume = nextVolume;
|
|
291
|
+
this.toastVolumeBarRef.style.width = `${nextVolume * 100}%`;
|
|
289
292
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
293
|
+
else if (gestureObj.type === 'adjustProgress') {
|
|
294
|
+
this.isDraggingProgress = true;
|
|
295
|
+
this.nextPercentage = Math.max(Math.min(this.lastPercentage + gestureObj.dataX, 1), 0);
|
|
296
|
+
if (this.controls && this.showProgress) {
|
|
297
|
+
this.controlsRef.setProgressBall(this.nextPercentage);
|
|
298
|
+
this.controlsRef.toggleVisibility(true);
|
|
299
|
+
}
|
|
300
|
+
const duration = this.duration || this._duration;
|
|
301
|
+
this.toastProgressTitleRef.innerHTML = `${formatTime(this.nextPercentage * duration)} / ${formatTime(duration)}`;
|
|
302
|
+
this.toastProgressRef.style.visibility = 'visible';
|
|
303
|
+
}
|
|
304
|
+
});
|
|
294
305
|
}
|
|
295
306
|
onDocumentTouchEnd() {
|
|
296
307
|
var _a;
|
|
@@ -309,28 +320,40 @@ export class Video {
|
|
|
309
320
|
this.lastTouchScreenY = undefined;
|
|
310
321
|
}
|
|
311
322
|
/** 播放视频 */
|
|
312
|
-
|
|
313
|
-
this
|
|
323
|
+
play() {
|
|
324
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
325
|
+
this._play();
|
|
326
|
+
});
|
|
314
327
|
}
|
|
315
328
|
/** 暂停视频 */
|
|
316
|
-
|
|
317
|
-
this
|
|
329
|
+
pause() {
|
|
330
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
331
|
+
this._pause();
|
|
332
|
+
});
|
|
318
333
|
}
|
|
319
334
|
/** 停止视频 */
|
|
320
|
-
|
|
321
|
-
this
|
|
335
|
+
stop() {
|
|
336
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
337
|
+
this._stop();
|
|
338
|
+
});
|
|
322
339
|
}
|
|
323
340
|
/** 跳转到指定位置 */
|
|
324
|
-
|
|
325
|
-
this
|
|
341
|
+
seek(position) {
|
|
342
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
343
|
+
this._seek(position);
|
|
344
|
+
});
|
|
326
345
|
}
|
|
327
346
|
/** 进入全屏。若有自定义内容需在全屏时展示,需将内容节点放置到 video 节点内。 */
|
|
328
|
-
|
|
329
|
-
this
|
|
347
|
+
requestFullScreen() {
|
|
348
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
349
|
+
this.toggleFullScreen(true);
|
|
350
|
+
});
|
|
330
351
|
}
|
|
331
352
|
/** 退出全屏 */
|
|
332
|
-
|
|
333
|
-
this
|
|
353
|
+
exitFullScreen() {
|
|
354
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
355
|
+
this.toggleFullScreen(false);
|
|
356
|
+
});
|
|
334
357
|
}
|
|
335
358
|
render() {
|
|
336
359
|
const { src, controls, autoplay, loop, muted, poster, objectFit, isFirst, isMute, isFullScreen, duration, _duration, showCenterPlayBtn, isPlaying, _enableDanmu, showMuteBtn, danmuBtn, showFullscreenBtn, nativeProps } = this;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
-
import { Component, Prop, h, Host, Listen, State, Event } from '@stencil/core';
|
|
2
|
+
import { Component, Prop, h, Host, Listen, State, Event, Element } from '@stencil/core';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
export class View {
|
|
5
5
|
constructor() {
|
|
@@ -40,6 +40,13 @@ export class View {
|
|
|
40
40
|
}, this.hoverStayTime);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
+
componentDidRender() {
|
|
44
|
+
const el = this.el;
|
|
45
|
+
el.childNodes.forEach(item => {
|
|
46
|
+
if (item.nodeType === document.COMMENT_NODE)
|
|
47
|
+
el.removeChild(item);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
43
50
|
render() {
|
|
44
51
|
const cls = classNames({
|
|
45
52
|
[`${this.hoverClass}`]: this.hover
|
|
@@ -151,6 +158,7 @@ export class View {
|
|
|
151
158
|
"references": {}
|
|
152
159
|
}
|
|
153
160
|
}]; }
|
|
161
|
+
static get elementRef() { return "el"; }
|
|
154
162
|
static get listeners() { return [{
|
|
155
163
|
"name": "touchstart",
|
|
156
164
|
"method": "onTouchStart",
|