@fibrae/semi-foundation 0.1.1 → 0.3.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/anchor/foundation.d.ts +1 -4
- package/dist/anchor/foundation.js +21 -22
- package/dist/audio-player/foundation.d.ts +10 -13
- package/dist/audio-player/foundation.js +19 -20
- package/dist/auto-complete/foundation.d.ts +12 -14
- package/dist/auto-complete/foundation.js +51 -52
- package/dist/avatar/foundation.d.ts +5 -6
- package/dist/avatar/foundation.js +16 -16
- package/dist/avatar/variables.scss +0 -1
- package/dist/backtop/foundation.d.ts +2 -5
- package/dist/backtop/foundation.js +7 -8
- package/dist/banner/foundation.d.ts +1 -1
- package/dist/banner/foundation.js +4 -4
- package/dist/base/auto-close-foundation.d.ts +8 -9
- package/dist/base/auto-close-foundation.js +15 -15
- package/dist/base/foundation.d.ts +4 -4
- package/dist/base/foundation.js +12 -11
- package/dist/base/list-store.d.ts +0 -1
- package/dist/breadcrumb/foundation.d.ts +5 -5
- package/dist/breadcrumb/foundation.js +9 -10
- package/dist/breadcrumb/item-foundation.d.ts +3 -3
- package/dist/breadcrumb/item-foundation.js +6 -6
- package/dist/calendar/event-util.d.ts +0 -10
- package/dist/calendar/event-util.js +1 -11
- package/dist/calendar/foundation.d.ts +1 -6
- package/dist/calendar/foundation.js +5 -9
- package/dist/calendar/month-foundation.d.ts +2 -3
- package/dist/calendar/month-foundation.js +6 -7
- package/dist/carousel/foundation.d.ts +17 -19
- package/dist/carousel/foundation.js +51 -51
- package/dist/cascader/foundation.d.ts +36 -32
- package/dist/cascader/foundation.js +145 -132
- package/dist/cascader/util.d.ts +1 -8
- package/dist/cascader/util.js +1 -8
- package/dist/checkbox/checkbox-foundation.d.ts +3 -7
- package/dist/checkbox/checkbox-foundation.js +15 -17
- package/dist/checkbox/checkbox-group-foundation.d.ts +2 -3
- package/dist/checkbox/checkbox-group-foundation.js +8 -8
- package/dist/code-highlight/index.d.ts +1 -2
- package/dist/code-highlight/index.js +3 -3
- package/dist/collapse/foundation.d.ts +2 -2
- package/dist/collapse/foundation.js +7 -7
- package/dist/collapsible/foundation.d.ts +3 -3
- package/dist/collapsible/foundation.js +8 -8
- package/dist/color-picker/alpha-slider-foundation.d.ts +2 -4
- package/dist/color-picker/alpha-slider-foundation.js +10 -10
- package/dist/color-picker/color-choose-area-foundation.d.ts +2 -5
- package/dist/color-picker/color-choose-area-foundation.js +14 -14
- package/dist/color-picker/color-picker.scss +0 -2
- package/dist/color-picker/color-slider-foundation.d.ts +2 -4
- package/dist/color-picker/color-slider-foundation.js +10 -10
- package/dist/color-picker/data-part-foundation.d.ts +5 -5
- package/dist/color-picker/data-part-foundation.js +11 -11
- package/dist/color-picker/foundation.d.ts +4 -4
- package/dist/color-picker/foundation.js +10 -10
- package/dist/color-picker/interface.d.ts +0 -1
- package/dist/config-provider/breakpoint-observer.d.ts +3 -3
- package/dist/config-provider/breakpoint-observer.js +6 -6
- package/dist/config-provider/responsive-types.d.ts +0 -16
- package/dist/cropper/foundation.d.ts +15 -16
- package/dist/cropper/foundation.js +26 -24
- package/dist/date-picker/_utils/get-default-picker-date.d.ts +0 -3
- package/dist/date-picker/_utils/get-default-picker-date.js +0 -3
- package/dist/date-picker/_utils/get-inset-input-format-token.d.ts +0 -2
- package/dist/date-picker/_utils/get-inset-input-format-token.js +0 -2
- package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.d.ts +0 -2
- package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.js +0 -2
- package/dist/date-picker/_utils/parser.d.ts +0 -3
- package/dist/date-picker/_utils/parser.js +0 -7
- package/dist/date-picker/_utils/picker-type.d.ts +1 -3
- package/dist/date-picker/_utils/picker-type.js +0 -2
- package/dist/date-picker/_utils/to-callback-args.d.ts +0 -1
- package/dist/date-picker/_utils/to-callback-args.js +0 -1
- package/dist/date-picker/date-picker.scss +0 -3
- package/dist/date-picker/foundation.d.ts +39 -58
- package/dist/date-picker/foundation.js +126 -153
- package/dist/date-picker/input-foundation.d.ts +10 -16
- package/dist/date-picker/input-foundation.js +28 -30
- package/dist/date-picker/month-foundation.d.ts +0 -3
- package/dist/date-picker/month-foundation.js +0 -2
- package/dist/date-picker/months-grid-foundation.d.ts +17 -26
- package/dist/date-picker/months-grid-foundation.js +65 -75
- package/dist/date-picker/year-and-month-foundation.d.ts +3 -3
- package/dist/date-picker/year-and-month-foundation.js +11 -11
- package/dist/drag-move/foundation.d.ts +2 -3
- package/dist/drag-move/foundation.js +15 -13
- package/dist/dropdown/foundation.d.ts +8 -7
- package/dist/dropdown/foundation.js +32 -28
- package/dist/dropdown/menu-foundation.d.ts +1 -2
- package/dist/dropdown/menu-foundation.js +11 -11
- package/dist/feedback/foundation.d.ts +9 -10
- package/dist/feedback/foundation.js +33 -33
- package/dist/feedback/variables.scss +1 -5
- package/dist/float-button/float-button.css +0 -1
- package/dist/float-button/float-button.scss +0 -2
- package/dist/form/form-api-proxy.d.ts +8 -7
- package/dist/form/form-api-proxy.js +25 -25
- package/dist/form/form.scss +0 -12
- package/dist/form/foundation.d.ts +5 -5
- package/dist/form/foundation.js +60 -76
- package/dist/form/interface.d.ts +2 -15
- package/dist/form/utils.d.ts +0 -8
- package/dist/form/utils.js +0 -7
- package/dist/form/variables.scss +1 -4
- package/dist/grid/variables.scss +0 -10
- package/dist/highlight/foundation.d.ts +0 -2
- package/dist/highlight/foundation.js +1 -3
- package/dist/hot-keys/foundation.d.ts +2 -3
- package/dist/hot-keys/foundation.js +5 -5
- package/dist/image/image-foundation.d.ts +4 -6
- package/dist/image/image-foundation.js +10 -10
- package/dist/image/preview-footer-foundation.d.ts +3 -4
- package/dist/image/preview-footer-foundation.js +10 -10
- package/dist/image/preview-foundation.d.ts +0 -3
- package/dist/image/preview-foundation.js +7 -6
- package/dist/image/preview-image-foundation.d.ts +6 -9
- package/dist/image/preview-image-foundation.js +14 -14
- package/dist/image/preview-inner-foundation.d.ts +9 -10
- package/dist/image/preview-inner-foundation.js +38 -38
- package/dist/input/foundation.d.ts +10 -11
- package/dist/input/foundation.js +47 -49
- package/dist/input/text-entry-foundation.d.ts +3 -5
- package/dist/input/text-entry-foundation.js +14 -15
- package/dist/input/textarea-foundation.d.ts +7 -8
- package/dist/input/textarea-foundation.js +36 -36
- package/dist/input-number/caret.d.ts +0 -1
- package/dist/input-number/caret.js +0 -1
- package/dist/input-number/foundation.d.ts +16 -19
- package/dist/input-number/foundation.js +54 -58
- package/dist/json-viewer/foundation.d.ts +8 -10
- package/dist/json-viewer/foundation.js +23 -24
- package/dist/locale/interface.d.ts +0 -3
- package/dist/lottie/foundation.d.ts +1 -1
- package/dist/lottie/foundation.js +4 -4
- package/dist/markdown-render/foundation.d.ts +2 -7
- package/dist/markdown-render/foundation.js +5 -9
- package/dist/modal/modal-content-foundation.d.ts +7 -7
- package/dist/modal/modal-content-foundation.js +20 -20
- package/dist/modal/modal-foundation.d.ts +6 -6
- package/dist/modal/modal-foundation.js +24 -24
- package/dist/navigation/foundation.d.ts +1 -8
- package/dist/navigation/foundation.js +14 -20
- package/dist/navigation/item-foundation.d.ts +1 -1
- package/dist/navigation/item-foundation.js +8 -8
- package/dist/navigation/sub-nav-foundation.d.ts +3 -4
- package/dist/navigation/sub-nav-foundation.js +17 -17
- package/dist/notification/notification-list-foundation.d.ts +7 -8
- package/dist/notification/notification-list-foundation.js +12 -13
- package/dist/notification/variables.scss +0 -1
- package/dist/overflow-list/foundation.d.ts +4 -6
- package/dist/overflow-list/foundation.js +18 -19
- package/dist/pagination/foundation.d.ts +8 -10
- package/dist/pagination/foundation.js +28 -28
- package/dist/pincode/foundation.d.ts +6 -9
- package/dist/pincode/foundation.js +23 -26
- package/dist/popconfirm/popconfirm-foundation.d.ts +7 -9
- package/dist/popconfirm/popconfirm-foundation.js +26 -26
- package/dist/progress/generates.d.ts +1 -4
- package/dist/progress/generates.js +1 -4
- package/dist/progress/utils.d.ts +1 -1
- package/dist/progress/utils.js +1 -1
- package/dist/radio/radio-foundation.d.ts +5 -9
- package/dist/radio/radio-foundation.js +15 -16
- package/dist/radio/radio-group-foundation.d.ts +2 -3
- package/dist/radio/radio-group-foundation.js +9 -9
- package/dist/rating/foundation.d.ts +10 -15
- package/dist/rating/foundation.js +35 -38
- package/dist/resizable/group/index.d.ts +6 -10
- package/dist/resizable/group/index.js +40 -44
- package/dist/resizable/resizable.scss +0 -1
- package/dist/resizable/single/index.d.ts +3 -7
- package/dist/resizable/single/index.js +10 -13
- package/dist/scroll-list/item-foundation.d.ts +7 -9
- package/dist/scroll-list/item-foundation.js +35 -36
- package/dist/scroll-list/variables.scss +1 -6
- package/dist/select/foundation.d.ts +42 -57
- package/dist/select/foundation.js +214 -279
- package/dist/select/option-foundation.d.ts +23 -28
- package/dist/select/option-foundation.js +10 -19
- package/dist/select/variables.scss +1 -8
- package/dist/side-sheet/side-sheet-foundation.d.ts +7 -12
- package/dist/side-sheet/side-sheet-foundation.js +23 -27
- package/dist/side-sheet/variables.scss +1 -3
- package/dist/slider/foundation.d.ts +17 -28
- package/dist/slider/foundation.js +47 -59
- package/dist/slider/variables.scss +1 -5
- package/dist/sortable/accessibility.d.ts +1 -1
- package/dist/sortable/accessibility.js +2 -2
- package/dist/spin/foundation.d.ts +2 -4
- package/dist/spin/foundation.js +6 -7
- package/dist/spin/variables.scss +1 -3
- package/dist/steps/utils.d.ts +1 -1
- package/dist/switch/foundation.d.ts +2 -3
- package/dist/switch/foundation.js +7 -7
- package/dist/switch/switch.scss +1 -1
- package/dist/switch/variables.scss +1 -5
- package/dist/table/foundation.d.ts +24 -33
- package/dist/table/foundation.js +144 -108
- package/dist/table/table.scss +0 -1
- package/dist/table/utils.d.ts +2 -10
- package/dist/table/utils.js +0 -13
- package/dist/table/variables.scss +1 -5
- package/dist/tabs/foundation.d.ts +5 -14
- package/dist/tabs/foundation.js +17 -21
- package/dist/tabs/tabs.scss +1 -1
- package/dist/tag/focus.js +0 -1
- package/dist/tag-input/foundation.d.ts +11 -13
- package/dist/tag-input/foundation.js +52 -53
- package/dist/tag-input/tag-input.scss +0 -1
- package/dist/tag-input/utils/tag-focus.d.ts +0 -1
- package/dist/tag-input/utils/tag-focus.js +0 -1
- package/dist/time-picker/combox-foundation.d.ts +3 -11
- package/dist/time-picker/combox-foundation.js +3 -10
- package/dist/time-picker/foundation.d.ts +13 -23
- package/dist/time-picker/foundation.js +39 -48
- package/dist/time-picker/input-foundation.d.ts +4 -4
- package/dist/time-picker/input-foundation.js +13 -13
- package/dist/time-picker/utils/index.d.ts +0 -11
- package/dist/time-picker/utils/index.js +0 -11
- package/dist/toast/toast-list-foundation.d.ts +7 -7
- package/dist/toast/toast-list-foundation.js +14 -14
- package/dist/tooltip/adjust-position.d.ts +1 -2
- package/dist/tooltip/constants.d.ts +0 -3
- package/dist/tooltip/constants.js +0 -3
- package/dist/tooltip/foundation.d.ts +9 -12
- package/dist/tooltip/foundation.js +67 -63
- package/dist/tooltip/position.scss +0 -1
- package/dist/transfer/foundation.d.ts +22 -13
- package/dist/transfer/foundation.js +38 -24
- package/dist/tree/foundation.d.ts +14 -16
- package/dist/tree/foundation.js +61 -62
- package/dist/tree/shared.d.ts +2 -4
- package/dist/tree/shared.js +0 -2
- package/dist/tree/tree-util.d.ts +0 -5
- package/dist/tree/tree-util.js +0 -5
- package/dist/tree-select/foundation.d.ts +26 -22
- package/dist/tree-select/foundation.js +91 -86
- package/dist/typography/ellipsis.d.ts +5 -7
- package/dist/typography/ellipsis.js +8 -10
- package/dist/typography/format-numeral.d.ts +1 -1
- package/dist/typography/format-numeral.js +2 -2
- package/dist/typography/typography.scss +0 -1
- package/dist/upload/constants.d.ts +1 -1
- package/dist/upload/foundation.d.ts +17 -23
- package/dist/upload/foundation.js +93 -103
- package/dist/upload/utils.d.ts +3 -8
- package/dist/upload/utils.js +6 -11
- package/dist/user-guide/foundation.d.ts +3 -5
- package/dist/user-guide/foundation.js +19 -19
- package/dist/utils/a11y.d.ts +2 -6
- package/dist/utils/a11y.js +1 -4
- package/dist/utils/announcer.d.ts +2 -2
- package/dist/utils/announcer.js +4 -4
- package/dist/utils/array.d.ts +0 -6
- package/dist/utils/array.js +0 -6
- package/dist/utils/date-fns-extra.js +1 -5
- package/dist/utils/dom.d.ts +0 -1
- package/dist/utils/dom.js +0 -1
- package/dist/utils/escape-html.js +0 -3
- package/dist/utils/field-sizing.d.ts +0 -2
- package/dist/utils/field-sizing.js +0 -2
- package/dist/utils/focus-handle.d.ts +1 -2
- package/dist/utils/focus-handle.js +1 -3
- package/dist/utils/focus-scope.d.ts +5 -6
- package/dist/utils/focus-scope.js +10 -11
- package/dist/utils/is-promise.d.ts +1 -1
- package/dist/utils/release-holder.d.ts +2 -2
- package/dist/utils/release-holder.js +4 -4
- package/dist/utils/scroll-lock.d.ts +3 -4
- package/dist/utils/scroll-lock.js +3 -4
- package/dist/utils/tween.d.ts +0 -1
- package/dist/utils/tween.js +0 -1
- package/dist/utils/uuid.d.ts +0 -1
- package/dist/utils/uuid.js +0 -1
- package/dist/utils/warning.d.ts +0 -1
- package/dist/utils/warning.js +0 -1
- package/dist/video-player/foundation.d.ts +15 -15
- package/dist/video-player/foundation.js +89 -89
- package/dist/video-player/progress-foundation.d.ts +2 -3
- package/dist/video-player/progress-foundation.js +12 -13
- package/dist/video-player/variables.scss +1 -1
- package/package.json +2 -2
|
@@ -13,32 +13,32 @@ var VideoPlayerFoundation = class extends BaseFoundation {
|
|
|
13
13
|
if (this.#controlsTimer) clearTimeout(this.#controlsTimer);
|
|
14
14
|
}
|
|
15
15
|
#handleMouseMove = throttle(() => {
|
|
16
|
-
this.
|
|
16
|
+
this.adapter.setShowControls(true);
|
|
17
17
|
this.#clearTimer();
|
|
18
18
|
this.#controlsTimer = setTimeout(() => {
|
|
19
|
-
if (this.getStates().isPlaying) this.
|
|
19
|
+
if (this.getStates().isPlaying) this.adapter.setShowControls(false);
|
|
20
20
|
}, 3e3);
|
|
21
21
|
}, 200);
|
|
22
22
|
#applyMuted(video, muted) {
|
|
23
23
|
video.muted = muted;
|
|
24
|
-
this.
|
|
24
|
+
this.adapter.setMuted(muted);
|
|
25
25
|
}
|
|
26
26
|
#handleLeavePictureInPicture = () => {
|
|
27
|
-
const video = this.
|
|
27
|
+
const video = this.adapter.getVideo();
|
|
28
28
|
if (!video) return;
|
|
29
|
-
this.
|
|
29
|
+
this.adapter.setIsPlaying(!video.paused);
|
|
30
30
|
};
|
|
31
31
|
#handleTemporaryNotification(content) {
|
|
32
32
|
this.#stalled = false;
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
33
|
+
this.adapter.setNotificationContent(content);
|
|
34
|
+
this.adapter.setShowNotification(true);
|
|
35
35
|
clearTimeout(this.#notificationTimer);
|
|
36
36
|
this.#notificationTimer = setTimeout(() => {
|
|
37
|
-
this.
|
|
37
|
+
this.adapter.setShowNotification(false);
|
|
38
38
|
}, 1e3);
|
|
39
39
|
}
|
|
40
40
|
#restorePlayPosition() {
|
|
41
|
-
const video = this.
|
|
41
|
+
const video = this.adapter.getVideo();
|
|
42
42
|
if (!video) return;
|
|
43
43
|
const wasPlaying = !video.paused;
|
|
44
44
|
const currentTime = video.currentTime;
|
|
@@ -56,7 +56,7 @@ var VideoPlayerFoundation = class extends BaseFoundation {
|
|
|
56
56
|
#handleFullscreenChange = () => {
|
|
57
57
|
const isFullScreen = this.checkFullScreen();
|
|
58
58
|
if (isFullScreen === this.getStates().isFullScreen) return;
|
|
59
|
-
this.
|
|
59
|
+
this.adapter.setIsFullScreen(isFullScreen);
|
|
60
60
|
if (isFullScreen) document.addEventListener("mousemove", this.#handleMouseMove, { signal: this.signal });
|
|
61
61
|
else {
|
|
62
62
|
if (this.#scrollPosition) setTimeout(() => {
|
|
@@ -66,7 +66,7 @@ var VideoPlayerFoundation = class extends BaseFoundation {
|
|
|
66
66
|
document.removeEventListener("mousemove", this.#handleMouseMove);
|
|
67
67
|
this.#handleMouseMove.cancel();
|
|
68
68
|
this.#clearTimer();
|
|
69
|
-
this.
|
|
69
|
+
this.adapter.setShowControls(true);
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
#handleBodyKeyDown = (e) => {
|
|
@@ -74,7 +74,7 @@ var VideoPlayerFoundation = class extends BaseFoundation {
|
|
|
74
74
|
const target = e.target instanceof Element ? e.target : null;
|
|
75
75
|
const ownsKey = e.key === " " ? "button, input, select, textarea" : "input, select, textarea, [role=\"slider\"], [role=\"menu\"]";
|
|
76
76
|
if (e.defaultPrevented || target?.closest(ownsKey)) return;
|
|
77
|
-
const videoWrapper = this.
|
|
77
|
+
const videoWrapper = this.adapter.getVideoWrapper();
|
|
78
78
|
if (videoWrapper && !videoWrapper.contains(FocusTrapHandle.getActiveElement(videoWrapper))) return;
|
|
79
79
|
const { currentTime } = this.getStates();
|
|
80
80
|
const { seekTime } = this.getProps();
|
|
@@ -89,25 +89,25 @@ var VideoPlayerFoundation = class extends BaseFoundation {
|
|
|
89
89
|
else if (e.key === "ArrowRight") this.handleTimeChange(currentTime + seekTime);
|
|
90
90
|
};
|
|
91
91
|
#registerEvent() {
|
|
92
|
-
const video = this.
|
|
92
|
+
const video = this.adapter.getVideo();
|
|
93
93
|
if (!video) return;
|
|
94
94
|
document.addEventListener("keydown", this.#handleBodyKeyDown, { signal: this.signal });
|
|
95
95
|
document.addEventListener("fullscreenchange", this.#handleFullscreenChange, { signal: this.signal });
|
|
96
96
|
video.addEventListener("leavepictureinpicture", this.#handleLeavePictureInPicture, { signal: this.signal });
|
|
97
97
|
}
|
|
98
98
|
checkFullScreen() {
|
|
99
|
-
const videoWrapper = this.
|
|
99
|
+
const videoWrapper = this.adapter.getVideoWrapper();
|
|
100
100
|
return !!videoWrapper && document.fullscreenElement === videoWrapper;
|
|
101
101
|
}
|
|
102
102
|
init() {
|
|
103
103
|
const { volume, muted } = this.getProps();
|
|
104
104
|
const { playbackRate } = this.getStates();
|
|
105
|
-
const video = this.
|
|
105
|
+
const video = this.adapter.getVideo();
|
|
106
106
|
if (video) {
|
|
107
|
-
this.
|
|
107
|
+
this.adapter.setTotalTime(video.duration || 0);
|
|
108
108
|
const initialVolume = Math.floor(volume > 0 ? volume : 0);
|
|
109
109
|
video.volume = initialVolume / 100;
|
|
110
|
-
this.
|
|
110
|
+
this.adapter.setVolume(initialVolume);
|
|
111
111
|
this.#applyMuted(video, muted || initialVolume === 0);
|
|
112
112
|
video.defaultPlaybackRate = video.playbackRate = playbackRate;
|
|
113
113
|
const captions = video.querySelector("track[default]");
|
|
@@ -121,117 +121,117 @@ var VideoPlayerFoundation = class extends BaseFoundation {
|
|
|
121
121
|
this.#clearTimer();
|
|
122
122
|
clearTimeout(this.#notificationTimer);
|
|
123
123
|
}
|
|
124
|
-
handleTimeChange(value) {
|
|
125
|
-
const video = this.
|
|
124
|
+
handleTimeChange = (value) => {
|
|
125
|
+
const video = this.adapter.getVideo();
|
|
126
126
|
if (!video) return;
|
|
127
127
|
if (Number.isFinite(value)) {
|
|
128
128
|
const time = Number.isFinite(video.duration) ? clamp(value, 0, video.duration) : Math.max(value, 0);
|
|
129
129
|
video.currentTime = time;
|
|
130
|
-
this.
|
|
130
|
+
this.adapter.setCurrentTime(time);
|
|
131
131
|
}
|
|
132
|
-
}
|
|
133
|
-
handleTimeUpdate() {
|
|
134
|
-
const video = this.
|
|
132
|
+
};
|
|
133
|
+
handleTimeUpdate = () => {
|
|
134
|
+
const video = this.adapter.getVideo();
|
|
135
135
|
if (!video) return;
|
|
136
|
-
this.
|
|
137
|
-
}
|
|
138
|
-
handleDurationChange() {
|
|
139
|
-
const video = this.
|
|
136
|
+
this.adapter.setCurrentTime(video.currentTime);
|
|
137
|
+
};
|
|
138
|
+
handleDurationChange = () => {
|
|
139
|
+
const video = this.adapter.getVideo();
|
|
140
140
|
if (!video) return;
|
|
141
|
-
this.
|
|
142
|
-
}
|
|
143
|
-
handleError() {
|
|
144
|
-
this.
|
|
145
|
-
}
|
|
141
|
+
this.adapter.setTotalTime(video.duration || 0);
|
|
142
|
+
};
|
|
143
|
+
handleError = () => {
|
|
144
|
+
this.adapter.setIsError(true);
|
|
145
|
+
};
|
|
146
146
|
handleLoadStart = () => {
|
|
147
|
-
this.
|
|
148
|
-
const video = this.
|
|
147
|
+
this.adapter.setIsError(false);
|
|
148
|
+
const video = this.adapter.getVideo();
|
|
149
149
|
if (!video) return;
|
|
150
|
-
this.
|
|
151
|
-
this.
|
|
150
|
+
this.adapter.setIsPlaying(!video.paused);
|
|
151
|
+
this.adapter.setBufferedValue(0);
|
|
152
152
|
};
|
|
153
|
-
handlePlayOrPause() {
|
|
154
|
-
const video = this.
|
|
153
|
+
handlePlayOrPause = () => {
|
|
154
|
+
const video = this.adapter.getVideo();
|
|
155
155
|
if (!video) return;
|
|
156
156
|
if (video.paused) this.handlePlay();
|
|
157
157
|
else this.handlePause();
|
|
158
|
-
}
|
|
158
|
+
};
|
|
159
159
|
handlePlay() {
|
|
160
|
-
const video = this.
|
|
160
|
+
const video = this.adapter.getVideo();
|
|
161
161
|
if (video) ignoreExpectedMediaErrors(video.play());
|
|
162
162
|
}
|
|
163
163
|
handlePause() {
|
|
164
|
-
const video = this.
|
|
164
|
+
const video = this.adapter.getVideo();
|
|
165
165
|
if (video) video.pause();
|
|
166
166
|
}
|
|
167
167
|
handleVideoPlay = () => {
|
|
168
|
-
this.
|
|
169
|
-
this.
|
|
168
|
+
this.adapter.setIsPlaying(true);
|
|
169
|
+
this.adapter.notifyPlay();
|
|
170
170
|
if (this.getStates().isFullScreen) this.#handleMouseMove();
|
|
171
171
|
};
|
|
172
172
|
handleVideoPause = () => {
|
|
173
|
-
this.
|
|
174
|
-
this.
|
|
175
|
-
if (this.getStates().isFullScreen) this.
|
|
173
|
+
this.adapter.setIsPlaying(false);
|
|
174
|
+
this.adapter.notifyPause();
|
|
175
|
+
if (this.getStates().isFullScreen) this.adapter.setShowControls(true);
|
|
176
176
|
};
|
|
177
177
|
handleCanPlay = () => {
|
|
178
178
|
this.#stalled = false;
|
|
179
|
-
this.
|
|
179
|
+
this.adapter.setShowNotification(false);
|
|
180
180
|
};
|
|
181
|
-
handleWaiting(locale) {
|
|
181
|
+
handleWaiting = (locale) => {
|
|
182
182
|
this.#stalled = false;
|
|
183
|
-
this.
|
|
184
|
-
this.
|
|
185
|
-
}
|
|
186
|
-
handleStalled(locale) {
|
|
183
|
+
this.adapter.setNotificationContent(locale.loading);
|
|
184
|
+
this.adapter.setShowNotification(true);
|
|
185
|
+
};
|
|
186
|
+
handleStalled = (locale) => {
|
|
187
187
|
this.#stalled = true;
|
|
188
|
-
this.
|
|
189
|
-
this.
|
|
190
|
-
}
|
|
188
|
+
this.adapter.setNotificationContent(locale.stall);
|
|
189
|
+
this.adapter.setShowNotification(true);
|
|
190
|
+
};
|
|
191
191
|
handleProgress = () => {
|
|
192
192
|
if (this.#stalled) {
|
|
193
193
|
this.#stalled = false;
|
|
194
|
-
this.
|
|
194
|
+
this.adapter.setShowNotification(false);
|
|
195
195
|
}
|
|
196
|
-
const video = this.
|
|
196
|
+
const video = this.adapter.getVideo();
|
|
197
197
|
if (video && video.buffered.length > 0) {
|
|
198
198
|
const bufferedEnd = video.buffered.end(video.buffered.length - 1);
|
|
199
|
-
this.
|
|
199
|
+
this.adapter.setBufferedValue(bufferedEnd);
|
|
200
200
|
}
|
|
201
201
|
};
|
|
202
202
|
handleEnded = () => {
|
|
203
|
-
this.
|
|
204
|
-
this.
|
|
203
|
+
this.adapter.setIsPlaying(false);
|
|
204
|
+
this.adapter.setShowControls(true);
|
|
205
205
|
};
|
|
206
206
|
/** From the user (the slider); init applies the initial volume without notifying */
|
|
207
|
-
handleVolumeChange(value) {
|
|
208
|
-
const video = this.
|
|
207
|
+
handleVolumeChange = (value) => {
|
|
208
|
+
const video = this.adapter.getVideo();
|
|
209
209
|
if (!video) return;
|
|
210
210
|
const { volume, muted } = this.getStates();
|
|
211
211
|
const next = Math.floor(value > 0 ? value : 0);
|
|
212
212
|
video.volume = next / 100;
|
|
213
|
-
this.
|
|
213
|
+
this.adapter.setVolume(next);
|
|
214
214
|
this.#applyMuted(video, next === 0);
|
|
215
|
-
if (next !== (muted ? 0 : volume)) this.
|
|
216
|
-
}
|
|
215
|
+
if (next !== (muted ? 0 : volume)) this.adapter.notifyVolumeChange(next);
|
|
216
|
+
};
|
|
217
217
|
/** Mutes, or unmutes to the volume before muting; to half volume when that was 0 */
|
|
218
218
|
handleVolumeSilent = () => {
|
|
219
|
-
const video = this.
|
|
219
|
+
const video = this.adapter.getVideo();
|
|
220
220
|
const { volume, muted } = this.getStates();
|
|
221
221
|
if (!video) return;
|
|
222
222
|
if (muted) {
|
|
223
223
|
const restored = volume > 0 ? volume : 50;
|
|
224
224
|
video.volume = restored / 100;
|
|
225
|
-
this.
|
|
225
|
+
this.adapter.setVolume(restored);
|
|
226
226
|
this.#applyMuted(video, false);
|
|
227
|
-
this.
|
|
227
|
+
this.adapter.notifyVolumeChange(restored);
|
|
228
228
|
} else {
|
|
229
229
|
this.#applyMuted(video, true);
|
|
230
|
-
this.
|
|
230
|
+
this.adapter.notifyVolumeChange(0);
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
233
|
handleFullscreen = () => {
|
|
234
|
-
const videoWrapper = this.
|
|
234
|
+
const videoWrapper = this.adapter.getVideoWrapper();
|
|
235
235
|
const isFullScreen = this.checkFullScreen();
|
|
236
236
|
if (videoWrapper) {
|
|
237
237
|
if (isFullScreen) ignoreExpectedMediaErrors(document.exitFullscreen());
|
|
@@ -244,44 +244,44 @@ var VideoPlayerFoundation = class extends BaseFoundation {
|
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
};
|
|
247
|
-
handleRateChange(rate, locale) {
|
|
248
|
-
const video = this.
|
|
247
|
+
handleRateChange = (rate, locale) => {
|
|
248
|
+
const video = this.adapter.getVideo();
|
|
249
249
|
if (!video) return;
|
|
250
250
|
video.defaultPlaybackRate = video.playbackRate = rate.value;
|
|
251
|
-
this.
|
|
252
|
-
this.
|
|
251
|
+
this.adapter.setPlaybackRate(rate.value);
|
|
252
|
+
this.adapter.notifyRateChange(rate.value);
|
|
253
253
|
this.#handleTemporaryNotification(locale.rateChange.replace("${rate}", () => rate.label));
|
|
254
|
-
}
|
|
255
|
-
handleQualityChange(quality, locale) {
|
|
254
|
+
};
|
|
255
|
+
handleQualityChange = (quality, locale) => {
|
|
256
256
|
const changed = quality.value !== this.getStates().currentQuality;
|
|
257
|
-
this.
|
|
258
|
-
this.
|
|
257
|
+
this.adapter.setQuality(quality.value);
|
|
258
|
+
this.adapter.notifyQualityChange(quality.value);
|
|
259
259
|
this.#handleTemporaryNotification(locale.qualityChange.replace("${quality}", () => quality.label));
|
|
260
260
|
if (changed) this.#restorePlayPosition();
|
|
261
|
-
}
|
|
262
|
-
handleRouteChange(route, locale) {
|
|
261
|
+
};
|
|
262
|
+
handleRouteChange = (route, locale) => {
|
|
263
263
|
const changed = route.value !== this.getStates().currentRoute;
|
|
264
|
-
this.
|
|
265
|
-
this.
|
|
264
|
+
this.adapter.setRoute(route.value);
|
|
265
|
+
this.adapter.notifyRouteChange(route.value);
|
|
266
266
|
this.#handleTemporaryNotification(locale.routeChange.replace("${route}", () => route.label));
|
|
267
267
|
if (changed) this.#restorePlayPosition();
|
|
268
|
-
}
|
|
269
|
-
handleMirror(locale) {
|
|
268
|
+
};
|
|
269
|
+
handleMirror = (locale) => {
|
|
270
270
|
const { isMirror } = this.getStates();
|
|
271
|
-
this.
|
|
271
|
+
this.adapter.setIsMirror(!isMirror);
|
|
272
272
|
this.#handleTemporaryNotification(!isMirror ? locale.mirror : locale.cancelMirror);
|
|
273
|
-
}
|
|
273
|
+
};
|
|
274
274
|
handlePictureInPicture = () => {
|
|
275
|
-
const video = this.
|
|
275
|
+
const video = this.adapter.getVideo();
|
|
276
276
|
if (!video) return;
|
|
277
277
|
ignoreExpectedMediaErrors(video.requestPictureInPicture());
|
|
278
278
|
};
|
|
279
279
|
handleMouseEnterWrapper = () => {
|
|
280
|
-
this.
|
|
280
|
+
this.adapter.setShowControls(true);
|
|
281
281
|
};
|
|
282
282
|
handleMouseLeaveWrapper = () => {
|
|
283
283
|
const { isPlaying } = this.getStates();
|
|
284
|
-
if (isPlaying) this.
|
|
284
|
+
if (isPlaying) this.adapter.setShowControls(false);
|
|
285
285
|
};
|
|
286
286
|
};
|
|
287
287
|
export { VideoPlayerFoundation as default };
|
|
@@ -58,7 +58,6 @@ export default class VideoProgressFoundation<P extends VideoProgressBaseProps =
|
|
|
58
58
|
static getMarkerTitle(list: MarkerListItem[], value: number): string | undefined;
|
|
59
59
|
/** The handle's `left`; the 8px is half the handle's width in the stylesheet */
|
|
60
60
|
static getHandleLeft(value: number, max: number): string;
|
|
61
|
-
/** How much of a marker `value` covers, as a CSS width */
|
|
62
61
|
static getValueWidth({ start, end }: MarkerListItem, value: number): string;
|
|
63
62
|
/** The APG slider keys: arrows move by `step`, PageUp and PageDown by a tenth of `max`, Home and End to the ends */
|
|
64
63
|
handleKeyDown: (e: ProgressKeyboardEvent) => void;
|
|
@@ -74,7 +73,7 @@ export default class VideoProgressFoundation<P extends VideoProgressBaseProps =
|
|
|
74
73
|
/** Follows pointerup and pointercancel, and also fires when the bar leaves the page mid-drag */
|
|
75
74
|
handleLostPointerCapture: () => void;
|
|
76
75
|
/** Tracks the pointer over the bar for the tooltip; `seek` also moves the playhead while dragging or on the press. */
|
|
77
|
-
handlePointerPosition(e: ProgressPointerEvent, { seek }: {
|
|
76
|
+
handlePointerPosition: (e: ProgressPointerEvent, { seek }: {
|
|
78
77
|
seek: boolean;
|
|
79
|
-
})
|
|
78
|
+
}) => void;
|
|
80
79
|
}
|
|
@@ -5,8 +5,8 @@ import { clamp } from "es-toolkit";
|
|
|
5
5
|
// src/video-player/progress-foundation.ts
|
|
6
6
|
var VideoProgressFoundation = class VideoProgressFoundation extends BaseFoundation {
|
|
7
7
|
#setActiveIndex(currentValue) {
|
|
8
|
-
this.
|
|
9
|
-
if (VideoProgressFoundation.isInMarker(marker, currentValue)) this.
|
|
8
|
+
this.adapter.getMarkersList().forEach((marker, index) => {
|
|
9
|
+
if (VideoProgressFoundation.isInMarker(marker, currentValue)) this.adapter.setActiveIndex(index);
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
@@ -53,7 +53,6 @@ var VideoProgressFoundation = class VideoProgressFoundation extends BaseFoundati
|
|
|
53
53
|
static getHandleLeft(value, max) {
|
|
54
54
|
return `calc(${(max ? value / max : 0) * 100}% - 8px)`;
|
|
55
55
|
}
|
|
56
|
-
/** How much of a marker `value` covers, as a CSS width */
|
|
57
56
|
static getValueWidth({ start, end }, value) {
|
|
58
57
|
if (end <= start) return "0%";
|
|
59
58
|
if (value > end) return "calc(100% - 2px)";
|
|
@@ -76,42 +75,42 @@ var VideoProgressFoundation = class VideoProgressFoundation extends BaseFoundati
|
|
|
76
75
|
};
|
|
77
76
|
if (!Object.hasOwn(targets, e.key)) return;
|
|
78
77
|
e.preventDefault();
|
|
79
|
-
this.
|
|
80
|
-
this.
|
|
78
|
+
this.adapter.setMovingInfo(null);
|
|
79
|
+
this.adapter.notifyChange(clamp(targets[e.key], 0, max));
|
|
81
80
|
};
|
|
82
81
|
/** A keyboard focus shows the playhead's time, not the last hovered one */
|
|
83
82
|
handleFocus = (e) => {
|
|
84
|
-
if (e.currentTarget.matches(":focus-visible")) this.
|
|
83
|
+
if (e.currentTarget.matches(":focus-visible")) this.adapter.setMovingInfo(null);
|
|
85
84
|
};
|
|
86
85
|
/** The bar keeps the pointer from the press on, so the moves and the release reach it even outside it */
|
|
87
86
|
handlePointerDown = (e) => {
|
|
88
87
|
if (isSecondaryPress(e)) return;
|
|
89
88
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
90
|
-
this.
|
|
89
|
+
this.adapter.setIsDragging(true);
|
|
91
90
|
this.handlePointerPosition(e, { seek: true });
|
|
92
91
|
};
|
|
93
92
|
/** Follows pointerup and pointercancel, and also fires when the bar leaves the page mid-drag */
|
|
94
93
|
handleLostPointerCapture = () => {
|
|
95
|
-
this.
|
|
94
|
+
this.adapter.setIsDragging(false);
|
|
96
95
|
};
|
|
97
96
|
/** Tracks the pointer over the bar for the tooltip; `seek` also moves the playhead while dragging or on the press. */
|
|
98
|
-
handlePointerPosition(e, { seek }) {
|
|
97
|
+
handlePointerPosition = (e, { seek }) => {
|
|
99
98
|
const { isDragging } = this.getStates();
|
|
100
99
|
const { max } = this.getProps();
|
|
101
|
-
const sliderRef = this.
|
|
100
|
+
const sliderRef = this.adapter.getSliderRef();
|
|
102
101
|
if (!sliderRef) return;
|
|
103
102
|
const rect = sliderRef.getBoundingClientRect();
|
|
104
103
|
const { offset, ratio: percentage } = getPointerRatio(rect, e, false);
|
|
105
104
|
const value = percentage * max;
|
|
106
105
|
if (seek && (isDragging || e.type === "pointerdown")) {
|
|
107
106
|
this.#setActiveIndex(value);
|
|
108
|
-
this.
|
|
107
|
+
this.adapter.notifyChange(value);
|
|
109
108
|
}
|
|
110
|
-
this.
|
|
109
|
+
this.adapter.setMovingInfo({
|
|
111
110
|
progress: percentage,
|
|
112
111
|
offset: offset - rect.width / 2,
|
|
113
112
|
value
|
|
114
113
|
});
|
|
115
|
-
}
|
|
114
|
+
};
|
|
116
115
|
};
|
|
117
116
|
export { VideoProgressFoundation as default };
|
|
@@ -9,7 +9,7 @@ $color-videoPlayer_notification-bg: var(--semi-color-overlay-bg); // notificatio
|
|
|
9
9
|
$color-videoPlayer_notification-text: var(--semi-color-default); // notification 字体色
|
|
10
10
|
$color-videoPlayer_controls-bg: rgba(28, 31, 35, 0.8); // 控制栏背景色
|
|
11
11
|
$color-videoPlayer_controls-text: #fff; // 控制栏文字色
|
|
12
|
-
//
|
|
12
|
+
// control bar text is always white, so this cannot use --semi-grey-8, which flips with the theme
|
|
13
13
|
$color-videoPlayer_controls_popup-bg: rgb(46, 50, 56); // 音量弹层与菜单背景色
|
|
14
14
|
$color-videoPlayer_controls_item_popup-bg-default: var(--semi-color-overlay-bg); // 控制栏弹层背景色
|
|
15
15
|
$color-videoPlayer_controls_item_popup-bg-hover: rgba(67, 68, 74, 1); // 控制栏弹层背景色 - hover
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibrae/semi-foundation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://semi-design-next.pages.dev",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@date-fns/tz": "^1.5.0",
|
|
27
27
|
"@dnd-kit/dom": "~0.5.1",
|
|
28
|
-
"@fibrae/semi-json-viewer-core": "0.
|
|
28
|
+
"@fibrae/semi-json-viewer-core": "0.3.0",
|
|
29
29
|
"@mdx-js/mdx": "^3.1.1",
|
|
30
30
|
"@shikijs/core": "^4.5.0",
|
|
31
31
|
"async-validator": "^4.2.5",
|