@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.
Files changed (282) hide show
  1. package/dist/anchor/foundation.d.ts +1 -4
  2. package/dist/anchor/foundation.js +21 -22
  3. package/dist/audio-player/foundation.d.ts +10 -13
  4. package/dist/audio-player/foundation.js +19 -20
  5. package/dist/auto-complete/foundation.d.ts +12 -14
  6. package/dist/auto-complete/foundation.js +51 -52
  7. package/dist/avatar/foundation.d.ts +5 -6
  8. package/dist/avatar/foundation.js +16 -16
  9. package/dist/avatar/variables.scss +0 -1
  10. package/dist/backtop/foundation.d.ts +2 -5
  11. package/dist/backtop/foundation.js +7 -8
  12. package/dist/banner/foundation.d.ts +1 -1
  13. package/dist/banner/foundation.js +4 -4
  14. package/dist/base/auto-close-foundation.d.ts +8 -9
  15. package/dist/base/auto-close-foundation.js +15 -15
  16. package/dist/base/foundation.d.ts +4 -4
  17. package/dist/base/foundation.js +12 -11
  18. package/dist/base/list-store.d.ts +0 -1
  19. package/dist/breadcrumb/foundation.d.ts +5 -5
  20. package/dist/breadcrumb/foundation.js +9 -10
  21. package/dist/breadcrumb/item-foundation.d.ts +3 -3
  22. package/dist/breadcrumb/item-foundation.js +6 -6
  23. package/dist/calendar/event-util.d.ts +0 -10
  24. package/dist/calendar/event-util.js +1 -11
  25. package/dist/calendar/foundation.d.ts +1 -6
  26. package/dist/calendar/foundation.js +5 -9
  27. package/dist/calendar/month-foundation.d.ts +2 -3
  28. package/dist/calendar/month-foundation.js +6 -7
  29. package/dist/carousel/foundation.d.ts +17 -19
  30. package/dist/carousel/foundation.js +51 -51
  31. package/dist/cascader/foundation.d.ts +36 -32
  32. package/dist/cascader/foundation.js +145 -132
  33. package/dist/cascader/util.d.ts +1 -8
  34. package/dist/cascader/util.js +1 -8
  35. package/dist/checkbox/checkbox-foundation.d.ts +3 -7
  36. package/dist/checkbox/checkbox-foundation.js +15 -17
  37. package/dist/checkbox/checkbox-group-foundation.d.ts +2 -3
  38. package/dist/checkbox/checkbox-group-foundation.js +8 -8
  39. package/dist/code-highlight/index.d.ts +1 -2
  40. package/dist/code-highlight/index.js +3 -3
  41. package/dist/collapse/foundation.d.ts +2 -2
  42. package/dist/collapse/foundation.js +7 -7
  43. package/dist/collapsible/foundation.d.ts +3 -3
  44. package/dist/collapsible/foundation.js +8 -8
  45. package/dist/color-picker/alpha-slider-foundation.d.ts +2 -4
  46. package/dist/color-picker/alpha-slider-foundation.js +10 -10
  47. package/dist/color-picker/color-choose-area-foundation.d.ts +2 -5
  48. package/dist/color-picker/color-choose-area-foundation.js +14 -14
  49. package/dist/color-picker/color-picker.scss +0 -2
  50. package/dist/color-picker/color-slider-foundation.d.ts +2 -4
  51. package/dist/color-picker/color-slider-foundation.js +10 -10
  52. package/dist/color-picker/data-part-foundation.d.ts +5 -5
  53. package/dist/color-picker/data-part-foundation.js +11 -11
  54. package/dist/color-picker/foundation.d.ts +4 -4
  55. package/dist/color-picker/foundation.js +10 -10
  56. package/dist/color-picker/interface.d.ts +0 -1
  57. package/dist/config-provider/breakpoint-observer.d.ts +3 -3
  58. package/dist/config-provider/breakpoint-observer.js +6 -6
  59. package/dist/config-provider/responsive-types.d.ts +0 -16
  60. package/dist/cropper/foundation.d.ts +15 -16
  61. package/dist/cropper/foundation.js +26 -24
  62. package/dist/date-picker/_utils/get-default-picker-date.d.ts +0 -3
  63. package/dist/date-picker/_utils/get-default-picker-date.js +0 -3
  64. package/dist/date-picker/_utils/get-inset-input-format-token.d.ts +0 -2
  65. package/dist/date-picker/_utils/get-inset-input-format-token.js +0 -2
  66. package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.d.ts +0 -2
  67. package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.js +0 -2
  68. package/dist/date-picker/_utils/parser.d.ts +0 -3
  69. package/dist/date-picker/_utils/parser.js +0 -7
  70. package/dist/date-picker/_utils/picker-type.d.ts +1 -3
  71. package/dist/date-picker/_utils/picker-type.js +0 -2
  72. package/dist/date-picker/_utils/to-callback-args.d.ts +0 -1
  73. package/dist/date-picker/_utils/to-callback-args.js +0 -1
  74. package/dist/date-picker/date-picker.scss +0 -3
  75. package/dist/date-picker/foundation.d.ts +39 -58
  76. package/dist/date-picker/foundation.js +126 -153
  77. package/dist/date-picker/input-foundation.d.ts +10 -16
  78. package/dist/date-picker/input-foundation.js +28 -30
  79. package/dist/date-picker/month-foundation.d.ts +0 -3
  80. package/dist/date-picker/month-foundation.js +0 -2
  81. package/dist/date-picker/months-grid-foundation.d.ts +17 -26
  82. package/dist/date-picker/months-grid-foundation.js +65 -75
  83. package/dist/date-picker/year-and-month-foundation.d.ts +3 -3
  84. package/dist/date-picker/year-and-month-foundation.js +11 -11
  85. package/dist/drag-move/foundation.d.ts +2 -3
  86. package/dist/drag-move/foundation.js +15 -13
  87. package/dist/dropdown/foundation.d.ts +8 -7
  88. package/dist/dropdown/foundation.js +32 -28
  89. package/dist/dropdown/menu-foundation.d.ts +1 -2
  90. package/dist/dropdown/menu-foundation.js +11 -11
  91. package/dist/feedback/foundation.d.ts +9 -10
  92. package/dist/feedback/foundation.js +33 -33
  93. package/dist/feedback/variables.scss +1 -5
  94. package/dist/float-button/float-button.css +0 -1
  95. package/dist/float-button/float-button.scss +0 -2
  96. package/dist/form/form-api-proxy.d.ts +8 -7
  97. package/dist/form/form-api-proxy.js +25 -25
  98. package/dist/form/form.scss +0 -12
  99. package/dist/form/foundation.d.ts +5 -5
  100. package/dist/form/foundation.js +60 -76
  101. package/dist/form/interface.d.ts +2 -15
  102. package/dist/form/utils.d.ts +0 -8
  103. package/dist/form/utils.js +0 -7
  104. package/dist/form/variables.scss +1 -4
  105. package/dist/grid/variables.scss +0 -10
  106. package/dist/highlight/foundation.d.ts +0 -2
  107. package/dist/highlight/foundation.js +1 -3
  108. package/dist/hot-keys/foundation.d.ts +2 -3
  109. package/dist/hot-keys/foundation.js +5 -5
  110. package/dist/image/image-foundation.d.ts +4 -6
  111. package/dist/image/image-foundation.js +10 -10
  112. package/dist/image/preview-footer-foundation.d.ts +3 -4
  113. package/dist/image/preview-footer-foundation.js +10 -10
  114. package/dist/image/preview-foundation.d.ts +0 -3
  115. package/dist/image/preview-foundation.js +7 -6
  116. package/dist/image/preview-image-foundation.d.ts +6 -9
  117. package/dist/image/preview-image-foundation.js +14 -14
  118. package/dist/image/preview-inner-foundation.d.ts +9 -10
  119. package/dist/image/preview-inner-foundation.js +38 -38
  120. package/dist/input/foundation.d.ts +10 -11
  121. package/dist/input/foundation.js +47 -49
  122. package/dist/input/text-entry-foundation.d.ts +3 -5
  123. package/dist/input/text-entry-foundation.js +14 -15
  124. package/dist/input/textarea-foundation.d.ts +7 -8
  125. package/dist/input/textarea-foundation.js +36 -36
  126. package/dist/input-number/caret.d.ts +0 -1
  127. package/dist/input-number/caret.js +0 -1
  128. package/dist/input-number/foundation.d.ts +16 -19
  129. package/dist/input-number/foundation.js +54 -58
  130. package/dist/json-viewer/foundation.d.ts +8 -10
  131. package/dist/json-viewer/foundation.js +23 -24
  132. package/dist/locale/interface.d.ts +0 -3
  133. package/dist/lottie/foundation.d.ts +1 -1
  134. package/dist/lottie/foundation.js +4 -4
  135. package/dist/markdown-render/foundation.d.ts +2 -7
  136. package/dist/markdown-render/foundation.js +5 -9
  137. package/dist/modal/modal-content-foundation.d.ts +7 -7
  138. package/dist/modal/modal-content-foundation.js +20 -20
  139. package/dist/modal/modal-foundation.d.ts +6 -6
  140. package/dist/modal/modal-foundation.js +24 -24
  141. package/dist/navigation/foundation.d.ts +1 -8
  142. package/dist/navigation/foundation.js +14 -20
  143. package/dist/navigation/item-foundation.d.ts +1 -1
  144. package/dist/navigation/item-foundation.js +8 -8
  145. package/dist/navigation/sub-nav-foundation.d.ts +3 -4
  146. package/dist/navigation/sub-nav-foundation.js +17 -17
  147. package/dist/notification/notification-list-foundation.d.ts +7 -8
  148. package/dist/notification/notification-list-foundation.js +12 -13
  149. package/dist/notification/variables.scss +0 -1
  150. package/dist/overflow-list/foundation.d.ts +4 -6
  151. package/dist/overflow-list/foundation.js +18 -19
  152. package/dist/pagination/foundation.d.ts +8 -10
  153. package/dist/pagination/foundation.js +28 -28
  154. package/dist/pincode/foundation.d.ts +6 -9
  155. package/dist/pincode/foundation.js +23 -26
  156. package/dist/popconfirm/popconfirm-foundation.d.ts +7 -9
  157. package/dist/popconfirm/popconfirm-foundation.js +26 -26
  158. package/dist/progress/generates.d.ts +1 -4
  159. package/dist/progress/generates.js +1 -4
  160. package/dist/progress/utils.d.ts +1 -1
  161. package/dist/progress/utils.js +1 -1
  162. package/dist/radio/radio-foundation.d.ts +5 -9
  163. package/dist/radio/radio-foundation.js +15 -16
  164. package/dist/radio/radio-group-foundation.d.ts +2 -3
  165. package/dist/radio/radio-group-foundation.js +9 -9
  166. package/dist/rating/foundation.d.ts +10 -15
  167. package/dist/rating/foundation.js +35 -38
  168. package/dist/resizable/group/index.d.ts +6 -10
  169. package/dist/resizable/group/index.js +40 -44
  170. package/dist/resizable/resizable.scss +0 -1
  171. package/dist/resizable/single/index.d.ts +3 -7
  172. package/dist/resizable/single/index.js +10 -13
  173. package/dist/scroll-list/item-foundation.d.ts +7 -9
  174. package/dist/scroll-list/item-foundation.js +35 -36
  175. package/dist/scroll-list/variables.scss +1 -6
  176. package/dist/select/foundation.d.ts +42 -57
  177. package/dist/select/foundation.js +214 -279
  178. package/dist/select/option-foundation.d.ts +23 -28
  179. package/dist/select/option-foundation.js +10 -19
  180. package/dist/select/variables.scss +1 -8
  181. package/dist/side-sheet/side-sheet-foundation.d.ts +7 -12
  182. package/dist/side-sheet/side-sheet-foundation.js +23 -27
  183. package/dist/side-sheet/variables.scss +1 -3
  184. package/dist/slider/foundation.d.ts +17 -28
  185. package/dist/slider/foundation.js +47 -59
  186. package/dist/slider/variables.scss +1 -5
  187. package/dist/sortable/accessibility.d.ts +1 -1
  188. package/dist/sortable/accessibility.js +2 -2
  189. package/dist/spin/foundation.d.ts +2 -4
  190. package/dist/spin/foundation.js +6 -7
  191. package/dist/spin/variables.scss +1 -3
  192. package/dist/steps/utils.d.ts +1 -1
  193. package/dist/switch/foundation.d.ts +2 -3
  194. package/dist/switch/foundation.js +7 -7
  195. package/dist/switch/switch.scss +1 -1
  196. package/dist/switch/variables.scss +1 -5
  197. package/dist/table/foundation.d.ts +24 -33
  198. package/dist/table/foundation.js +144 -108
  199. package/dist/table/table.scss +0 -1
  200. package/dist/table/utils.d.ts +2 -10
  201. package/dist/table/utils.js +0 -13
  202. package/dist/table/variables.scss +1 -5
  203. package/dist/tabs/foundation.d.ts +5 -14
  204. package/dist/tabs/foundation.js +17 -21
  205. package/dist/tabs/tabs.scss +1 -1
  206. package/dist/tag/focus.js +0 -1
  207. package/dist/tag-input/foundation.d.ts +11 -13
  208. package/dist/tag-input/foundation.js +52 -53
  209. package/dist/tag-input/tag-input.scss +0 -1
  210. package/dist/tag-input/utils/tag-focus.d.ts +0 -1
  211. package/dist/tag-input/utils/tag-focus.js +0 -1
  212. package/dist/time-picker/combox-foundation.d.ts +3 -11
  213. package/dist/time-picker/combox-foundation.js +3 -10
  214. package/dist/time-picker/foundation.d.ts +13 -23
  215. package/dist/time-picker/foundation.js +39 -48
  216. package/dist/time-picker/input-foundation.d.ts +4 -4
  217. package/dist/time-picker/input-foundation.js +13 -13
  218. package/dist/time-picker/utils/index.d.ts +0 -11
  219. package/dist/time-picker/utils/index.js +0 -11
  220. package/dist/toast/toast-list-foundation.d.ts +7 -7
  221. package/dist/toast/toast-list-foundation.js +14 -14
  222. package/dist/tooltip/adjust-position.d.ts +1 -2
  223. package/dist/tooltip/constants.d.ts +0 -3
  224. package/dist/tooltip/constants.js +0 -3
  225. package/dist/tooltip/foundation.d.ts +9 -12
  226. package/dist/tooltip/foundation.js +67 -63
  227. package/dist/tooltip/position.scss +0 -1
  228. package/dist/transfer/foundation.d.ts +22 -13
  229. package/dist/transfer/foundation.js +38 -24
  230. package/dist/tree/foundation.d.ts +14 -16
  231. package/dist/tree/foundation.js +61 -62
  232. package/dist/tree/shared.d.ts +2 -4
  233. package/dist/tree/shared.js +0 -2
  234. package/dist/tree/tree-util.d.ts +0 -5
  235. package/dist/tree/tree-util.js +0 -5
  236. package/dist/tree-select/foundation.d.ts +26 -22
  237. package/dist/tree-select/foundation.js +91 -86
  238. package/dist/typography/ellipsis.d.ts +5 -7
  239. package/dist/typography/ellipsis.js +8 -10
  240. package/dist/typography/format-numeral.d.ts +1 -1
  241. package/dist/typography/format-numeral.js +2 -2
  242. package/dist/typography/typography.scss +0 -1
  243. package/dist/upload/constants.d.ts +1 -1
  244. package/dist/upload/foundation.d.ts +17 -23
  245. package/dist/upload/foundation.js +93 -103
  246. package/dist/upload/utils.d.ts +3 -8
  247. package/dist/upload/utils.js +6 -11
  248. package/dist/user-guide/foundation.d.ts +3 -5
  249. package/dist/user-guide/foundation.js +19 -19
  250. package/dist/utils/a11y.d.ts +2 -6
  251. package/dist/utils/a11y.js +1 -4
  252. package/dist/utils/announcer.d.ts +2 -2
  253. package/dist/utils/announcer.js +4 -4
  254. package/dist/utils/array.d.ts +0 -6
  255. package/dist/utils/array.js +0 -6
  256. package/dist/utils/date-fns-extra.js +1 -5
  257. package/dist/utils/dom.d.ts +0 -1
  258. package/dist/utils/dom.js +0 -1
  259. package/dist/utils/escape-html.js +0 -3
  260. package/dist/utils/field-sizing.d.ts +0 -2
  261. package/dist/utils/field-sizing.js +0 -2
  262. package/dist/utils/focus-handle.d.ts +1 -2
  263. package/dist/utils/focus-handle.js +1 -3
  264. package/dist/utils/focus-scope.d.ts +5 -6
  265. package/dist/utils/focus-scope.js +10 -11
  266. package/dist/utils/is-promise.d.ts +1 -1
  267. package/dist/utils/release-holder.d.ts +2 -2
  268. package/dist/utils/release-holder.js +4 -4
  269. package/dist/utils/scroll-lock.d.ts +3 -4
  270. package/dist/utils/scroll-lock.js +3 -4
  271. package/dist/utils/tween.d.ts +0 -1
  272. package/dist/utils/tween.js +0 -1
  273. package/dist/utils/uuid.d.ts +0 -1
  274. package/dist/utils/uuid.js +0 -1
  275. package/dist/utils/warning.d.ts +0 -1
  276. package/dist/utils/warning.js +0 -1
  277. package/dist/video-player/foundation.d.ts +15 -15
  278. package/dist/video-player/foundation.js +89 -89
  279. package/dist/video-player/progress-foundation.d.ts +2 -3
  280. package/dist/video-player/progress-foundation.js +12 -13
  281. package/dist/video-player/variables.scss +1 -1
  282. 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._adapter.setShowControls(true);
16
+ this.adapter.setShowControls(true);
17
17
  this.#clearTimer();
18
18
  this.#controlsTimer = setTimeout(() => {
19
- if (this.getStates().isPlaying) this._adapter.setShowControls(false);
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._adapter.setMuted(muted);
24
+ this.adapter.setMuted(muted);
25
25
  }
26
26
  #handleLeavePictureInPicture = () => {
27
- const video = this._adapter.getVideo();
27
+ const video = this.adapter.getVideo();
28
28
  if (!video) return;
29
- this._adapter.setIsPlaying(!video.paused);
29
+ this.adapter.setIsPlaying(!video.paused);
30
30
  };
31
31
  #handleTemporaryNotification(content) {
32
32
  this.#stalled = false;
33
- this._adapter.setNotificationContent(content);
34
- this._adapter.setShowNotification(true);
33
+ this.adapter.setNotificationContent(content);
34
+ this.adapter.setShowNotification(true);
35
35
  clearTimeout(this.#notificationTimer);
36
36
  this.#notificationTimer = setTimeout(() => {
37
- this._adapter.setShowNotification(false);
37
+ this.adapter.setShowNotification(false);
38
38
  }, 1e3);
39
39
  }
40
40
  #restorePlayPosition() {
41
- const video = this._adapter.getVideo();
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._adapter.setIsFullScreen(isFullScreen);
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._adapter.setShowControls(true);
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._adapter.getVideoWrapper();
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._adapter.getVideo();
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._adapter.getVideoWrapper();
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._adapter.getVideo();
105
+ const video = this.adapter.getVideo();
106
106
  if (video) {
107
- this._adapter.setTotalTime(video.duration || 0);
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._adapter.setVolume(initialVolume);
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._adapter.getVideo();
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._adapter.setCurrentTime(time);
130
+ this.adapter.setCurrentTime(time);
131
131
  }
132
- }
133
- handleTimeUpdate() {
134
- const video = this._adapter.getVideo();
132
+ };
133
+ handleTimeUpdate = () => {
134
+ const video = this.adapter.getVideo();
135
135
  if (!video) return;
136
- this._adapter.setCurrentTime(video.currentTime);
137
- }
138
- handleDurationChange() {
139
- const video = this._adapter.getVideo();
136
+ this.adapter.setCurrentTime(video.currentTime);
137
+ };
138
+ handleDurationChange = () => {
139
+ const video = this.adapter.getVideo();
140
140
  if (!video) return;
141
- this._adapter.setTotalTime(video.duration || 0);
142
- }
143
- handleError() {
144
- this._adapter.setIsError(true);
145
- }
141
+ this.adapter.setTotalTime(video.duration || 0);
142
+ };
143
+ handleError = () => {
144
+ this.adapter.setIsError(true);
145
+ };
146
146
  handleLoadStart = () => {
147
- this._adapter.setIsError(false);
148
- const video = this._adapter.getVideo();
147
+ this.adapter.setIsError(false);
148
+ const video = this.adapter.getVideo();
149
149
  if (!video) return;
150
- this._adapter.setIsPlaying(!video.paused);
151
- this._adapter.setBufferedValue(0);
150
+ this.adapter.setIsPlaying(!video.paused);
151
+ this.adapter.setBufferedValue(0);
152
152
  };
153
- handlePlayOrPause() {
154
- const video = this._adapter.getVideo();
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._adapter.getVideo();
160
+ const video = this.adapter.getVideo();
161
161
  if (video) ignoreExpectedMediaErrors(video.play());
162
162
  }
163
163
  handlePause() {
164
- const video = this._adapter.getVideo();
164
+ const video = this.adapter.getVideo();
165
165
  if (video) video.pause();
166
166
  }
167
167
  handleVideoPlay = () => {
168
- this._adapter.setIsPlaying(true);
169
- this._adapter.notifyPlay();
168
+ this.adapter.setIsPlaying(true);
169
+ this.adapter.notifyPlay();
170
170
  if (this.getStates().isFullScreen) this.#handleMouseMove();
171
171
  };
172
172
  handleVideoPause = () => {
173
- this._adapter.setIsPlaying(false);
174
- this._adapter.notifyPause();
175
- if (this.getStates().isFullScreen) this._adapter.setShowControls(true);
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._adapter.setShowNotification(false);
179
+ this.adapter.setShowNotification(false);
180
180
  };
181
- handleWaiting(locale) {
181
+ handleWaiting = (locale) => {
182
182
  this.#stalled = false;
183
- this._adapter.setNotificationContent(locale.loading);
184
- this._adapter.setShowNotification(true);
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._adapter.setNotificationContent(locale.stall);
189
- this._adapter.setShowNotification(true);
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._adapter.setShowNotification(false);
194
+ this.adapter.setShowNotification(false);
195
195
  }
196
- const video = this._adapter.getVideo();
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._adapter.setBufferedValue(bufferedEnd);
199
+ this.adapter.setBufferedValue(bufferedEnd);
200
200
  }
201
201
  };
202
202
  handleEnded = () => {
203
- this._adapter.setIsPlaying(false);
204
- this._adapter.setShowControls(true);
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._adapter.getVideo();
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._adapter.setVolume(next);
213
+ this.adapter.setVolume(next);
214
214
  this.#applyMuted(video, next === 0);
215
- if (next !== (muted ? 0 : volume)) this._adapter.notifyVolumeChange(next);
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._adapter.getVideo();
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._adapter.setVolume(restored);
225
+ this.adapter.setVolume(restored);
226
226
  this.#applyMuted(video, false);
227
- this._adapter.notifyVolumeChange(restored);
227
+ this.adapter.notifyVolumeChange(restored);
228
228
  } else {
229
229
  this.#applyMuted(video, true);
230
- this._adapter.notifyVolumeChange(0);
230
+ this.adapter.notifyVolumeChange(0);
231
231
  }
232
232
  };
233
233
  handleFullscreen = () => {
234
- const videoWrapper = this._adapter.getVideoWrapper();
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._adapter.getVideo();
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._adapter.setPlaybackRate(rate.value);
252
- this._adapter.notifyRateChange(rate.value);
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._adapter.setQuality(quality.value);
258
- this._adapter.notifyQualityChange(quality.value);
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._adapter.setRoute(route.value);
265
- this._adapter.notifyRouteChange(route.value);
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._adapter.setIsMirror(!isMirror);
271
+ this.adapter.setIsMirror(!isMirror);
272
272
  this.#handleTemporaryNotification(!isMirror ? locale.mirror : locale.cancelMirror);
273
- }
273
+ };
274
274
  handlePictureInPicture = () => {
275
- const video = this._adapter.getVideo();
275
+ const video = this.adapter.getVideo();
276
276
  if (!video) return;
277
277
  ignoreExpectedMediaErrors(video.requestPictureInPicture());
278
278
  };
279
279
  handleMouseEnterWrapper = () => {
280
- this._adapter.setShowControls(true);
280
+ this.adapter.setShowControls(true);
281
281
  };
282
282
  handleMouseLeaveWrapper = () => {
283
283
  const { isPlaying } = this.getStates();
284
- if (isPlaying) this._adapter.setShowControls(false);
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
- }): void;
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._adapter.getMarkersList().forEach((marker, index) => {
9
- if (VideoProgressFoundation.isInMarker(marker, currentValue)) this._adapter.setActiveIndex(index);
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._adapter.setMovingInfo(null);
80
- this._adapter.notifyChange(clamp(targets[e.key], 0, max));
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._adapter.setMovingInfo(null);
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._adapter.setIsDragging(true);
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._adapter.setIsDragging(false);
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._adapter.getSliderRef();
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._adapter.notifyChange(value);
107
+ this.adapter.notifyChange(value);
109
108
  }
110
- this._adapter.setMovingInfo({
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
- // AudioPlayer 弹层在浅色下的深灰;控制栏文字固定为白色,所以不用随主题翻转的 --semi-grey-8
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.1.1",
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.1.1",
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",