chuijs 4.0.2 → 4.0.4

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 (292) hide show
  1. package/CHANGELOG.md +597 -0
  2. package/README.md +43 -644
  3. package/framework/appLayout/default/chui_app_layout.js +602 -496
  4. package/framework/appLayout/default/global_style.css +288 -97
  5. package/framework/appLayout/default/main_theme_style.css +188 -101
  6. package/framework/components/chui_accordion/accordion.js +38 -35
  7. package/framework/components/chui_accordion/styles.css +13 -12
  8. package/framework/components/chui_action_sheet/action_sheet.js +93 -64
  9. package/framework/components/chui_action_sheet/styles.css +12 -5
  10. package/framework/components/chui_actions_bar/actions_bar.js +338 -0
  11. package/framework/components/chui_actions_bar/styles.css +139 -0
  12. package/framework/components/chui_affix/affix.js +16 -11
  13. package/framework/components/chui_affix/styles.css +5 -0
  14. package/framework/components/chui_alert/alert.js +34 -19
  15. package/framework/components/chui_alert/styles.css +7 -0
  16. package/framework/components/chui_avatar/avatar.js +36 -35
  17. package/framework/components/chui_avatar/styles.css +1 -1
  18. package/framework/components/chui_avatar_group/avatar_group.js +25 -23
  19. package/framework/components/chui_avatar_group/styles.css +1 -1
  20. package/framework/components/chui_backtop/backtop.js +60 -21
  21. package/framework/components/chui_backtop/styles.css +21 -0
  22. package/framework/components/chui_badge/badge.js +30 -28
  23. package/framework/components/chui_badge/styles.css +6 -6
  24. package/framework/components/chui_banner/banner.js +222 -0
  25. package/framework/components/chui_banner/styles.css +170 -0
  26. package/framework/components/chui_breadcrumb/breadcrumb.js +15 -13
  27. package/framework/components/chui_breadcrumb/styles.css +1 -1
  28. package/framework/components/chui_button/button.js +52 -36
  29. package/framework/components/chui_button/styles.css +7 -7
  30. package/framework/components/chui_calendar/calendar.js +18 -16
  31. package/framework/components/chui_card/card.js +52 -32
  32. package/framework/components/chui_card_scroll/card_scroll.js +169 -0
  33. package/framework/components/chui_card_scroll/styles.css +86 -0
  34. package/framework/components/chui_chat/chat.js +140 -79
  35. package/framework/components/chui_chat/styles.css +18 -7
  36. package/framework/components/chui_clipboard_history/clipboard_history.js +53 -39
  37. package/framework/components/chui_clipboard_history/styles.css +13 -9
  38. package/framework/components/chui_code/code.js +10 -10
  39. package/framework/components/chui_code/styles.css +4 -4
  40. package/framework/components/chui_code_editor/code_editor.js +73 -57
  41. package/framework/components/chui_code_editor/styles.css +6 -5
  42. package/framework/components/chui_command_palette/command_palette.js +87 -64
  43. package/framework/components/chui_command_palette/styles.css +5 -5
  44. package/framework/components/chui_console/console.js +13 -13
  45. package/framework/components/chui_console/styles.css +6 -3
  46. package/framework/components/chui_content_block/content_block.js +35 -21
  47. package/framework/components/chui_content_block/styles.css +2 -2
  48. package/framework/components/chui_context_menu/context_menu.js +171 -58
  49. package/framework/components/chui_context_menu/styles.css +82 -8
  50. package/framework/components/chui_custom_element/custom_element.js +25 -18
  51. package/framework/components/chui_data_grid/data_grid.js +633 -471
  52. package/framework/components/chui_data_grid/styles.css +24 -22
  53. package/framework/components/chui_descriptions/descriptions.js +34 -17
  54. package/framework/components/chui_descriptions/styles.css +1 -1
  55. package/framework/components/chui_details/details.js +42 -36
  56. package/framework/components/chui_details/styles.css +12 -11
  57. package/framework/components/chui_diff_viewer/diff_viewer.js +172 -147
  58. package/framework/components/chui_diff_viewer/styles.css +10 -10
  59. package/framework/components/chui_divider/divider.js +19 -17
  60. package/framework/components/chui_divider/styles.css +2 -2
  61. package/framework/components/chui_drawer/drawer.js +63 -38
  62. package/framework/components/chui_drawer/styles.css +18 -4
  63. package/framework/components/chui_drop_zone/drop_zone.js +37 -27
  64. package/framework/components/chui_drop_zone/styles.css +10 -6
  65. package/framework/components/chui_empty_state/empty_state.js +20 -15
  66. package/framework/components/chui_fieldset/fieldset.js +40 -23
  67. package/framework/components/chui_fieldset/styles.css +6 -6
  68. package/framework/components/chui_file_explorer/file_explorer.js +260 -189
  69. package/framework/components/chui_file_explorer/styles.css +8 -7
  70. package/framework/components/chui_form/form.js +40 -28
  71. package/framework/components/chui_form/styles.css +1 -1
  72. package/framework/components/chui_gantt/gantt.js +102 -78
  73. package/framework/components/chui_gantt/styles.css +5 -5
  74. package/framework/components/chui_graphs/graphs.js +376 -239
  75. package/framework/components/chui_graphs/styles.css +27 -6
  76. package/framework/components/chui_hero/hero.js +98 -37
  77. package/framework/components/chui_hero/styles.css +176 -7
  78. package/framework/components/chui_html_block/html_block.js +8 -8
  79. package/framework/components/chui_html_block/styles.css +3 -3
  80. package/framework/components/chui_hx/hx.js +3 -3
  81. package/framework/components/chui_hx/styles.css +13 -6
  82. package/framework/components/chui_icons/icons.js +2115 -2115
  83. package/framework/components/chui_icons/styles.css +4 -3
  84. package/framework/components/chui_inputs/chui_check_box/check_box.js +31 -19
  85. package/framework/components/chui_inputs/chui_check_box/styles.css +30 -21
  86. package/framework/components/chui_inputs/chui_chips/chips.js +141 -70
  87. package/framework/components/chui_inputs/chui_chips/styles.css +32 -7
  88. package/framework/components/chui_inputs/chui_color_picker/color_picker.js +55 -38
  89. package/framework/components/chui_inputs/chui_color_picker/styles.css +7 -7
  90. package/framework/components/chui_inputs/chui_combo_box/combo_box.js +127 -109
  91. package/framework/components/chui_inputs/chui_combo_box/styles.css +23 -21
  92. package/framework/components/chui_inputs/chui_date/date.js +161 -127
  93. package/framework/components/chui_inputs/chui_date/styles.css +20 -19
  94. package/framework/components/chui_inputs/chui_date_range/date_range.js +61 -50
  95. package/framework/components/chui_inputs/chui_date_range/styles.css +3 -3
  96. package/framework/components/chui_inputs/chui_datetime/datetime.js +47 -39
  97. package/framework/components/chui_inputs/chui_datetime/styles.css +3 -3
  98. package/framework/components/chui_inputs/chui_email/email.js +48 -36
  99. package/framework/components/chui_inputs/chui_email/styles.css +11 -11
  100. package/framework/components/chui_inputs/chui_file/file.js +71 -44
  101. package/framework/components/chui_inputs/chui_file/styles.css +23 -19
  102. package/framework/components/chui_inputs/chui_hotkey/hotkey.js +101 -76
  103. package/framework/components/chui_inputs/chui_hotkey/styles.css +6 -6
  104. package/framework/components/chui_inputs/chui_masked/masked.js +83 -72
  105. package/framework/components/chui_inputs/chui_masked/styles.css +5 -5
  106. package/framework/components/chui_inputs/chui_mention/mention.js +87 -40
  107. package/framework/components/chui_inputs/chui_mention/styles.css +14 -8
  108. package/framework/components/chui_inputs/chui_multi_combo_box/multi_combo_box.js +242 -212
  109. package/framework/components/chui_inputs/chui_multi_combo_box/styles.css +23 -15
  110. package/framework/components/chui_inputs/chui_number/number.js +84 -70
  111. package/framework/components/chui_inputs/chui_number/styles.css +13 -13
  112. package/framework/components/chui_inputs/chui_otp/otp.js +71 -62
  113. package/framework/components/chui_inputs/chui_otp/styles.css +5 -5
  114. package/framework/components/chui_inputs/chui_password/password.js +72 -56
  115. package/framework/components/chui_inputs/chui_password/styles.css +15 -15
  116. package/framework/components/chui_inputs/chui_radio_button/radio_button.js +37 -25
  117. package/framework/components/chui_inputs/chui_radio_button/styles.css +22 -22
  118. package/framework/components/chui_inputs/chui_rating/rating.js +54 -50
  119. package/framework/components/chui_inputs/chui_rating/styles.css +3 -3
  120. package/framework/components/chui_inputs/chui_select_box/select_box.js +132 -108
  121. package/framework/components/chui_inputs/chui_select_box/styles.css +21 -21
  122. package/framework/components/chui_inputs/chui_slider/slider.js +41 -38
  123. package/framework/components/chui_inputs/chui_slider/styles.css +7 -5
  124. package/framework/components/chui_inputs/chui_text/styles.css +14 -14
  125. package/framework/components/chui_inputs/chui_text/text.js +69 -52
  126. package/framework/components/chui_inputs/chui_text_area/styles.css +14 -14
  127. package/framework/components/chui_inputs/chui_text_area/text_area.js +59 -36
  128. package/framework/components/chui_inputs/chui_time/styles.css +18 -20
  129. package/framework/components/chui_inputs/chui_time/time.js +71 -49
  130. package/framework/components/chui_inputs/chui_toggle/styles.css +13 -6
  131. package/framework/components/chui_inputs/chui_toggle/toggle.js +27 -27
  132. package/framework/components/chui_json_editor/json_editor.js +137 -127
  133. package/framework/components/chui_json_editor/styles.css +5 -5
  134. package/framework/components/chui_json_viewer/json_viewer.js +133 -114
  135. package/framework/components/chui_json_viewer/styles.css +9 -8
  136. package/framework/components/chui_kanban/kanban.js +78 -60
  137. package/framework/components/chui_kanban/styles.css +8 -4
  138. package/framework/components/chui_kbd/kbd.js +12 -10
  139. package/framework/components/chui_kbd/styles.css +1 -1
  140. package/framework/components/chui_label/label.js +31 -29
  141. package/framework/components/chui_label/styles.css +3 -3
  142. package/framework/components/chui_link/link.js +36 -29
  143. package/framework/components/chui_link/styles.css +11 -4
  144. package/framework/components/chui_list/list.js +42 -38
  145. package/framework/components/chui_list/styles.css +4 -3
  146. package/framework/components/chui_markdown_editor/markdown_editor.js +125 -109
  147. package/framework/components/chui_markdown_editor/styles.css +5 -5
  148. package/framework/components/chui_media/audio.js +457 -364
  149. package/framework/components/chui_media/audio_styles.css +74 -37
  150. package/framework/components/chui_media/image.js +99 -64
  151. package/framework/components/chui_media/image_compare.js +86 -55
  152. package/framework/components/chui_media/image_compare_styles.css +5 -5
  153. package/framework/components/chui_media/image_styles.css +4 -4
  154. package/framework/components/chui_media/video.js +264 -171
  155. package/framework/components/chui_media/video_styles.css +57 -24
  156. package/framework/components/chui_menu_bar/menu_bar.js +67 -65
  157. package/framework/components/chui_menu_bar/styles.css +14 -12
  158. package/framework/components/chui_message_bar/message_bar.js +551 -0
  159. package/framework/components/chui_message_bar/styles.css +248 -0
  160. package/framework/components/chui_modal/modal.js +81 -56
  161. package/framework/components/chui_modal/styles.css +3 -2
  162. package/framework/components/chui_notification/notification.js +107 -69
  163. package/framework/components/chui_notification/notification_download.js +28 -77
  164. package/framework/components/chui_notification/notification_download_card.js +115 -0
  165. package/framework/components/chui_notification/notification_download_progress.css +5 -4
  166. package/framework/components/chui_notification/notification_download_progress.js +73 -105
  167. package/framework/components/chui_notification/notification_update.js +44 -37
  168. package/framework/components/chui_notification/status_plate.css +3 -3
  169. package/framework/components/chui_notification/status_plate.js +2 -2
  170. package/framework/components/chui_notification/styles.css +6 -1
  171. package/framework/components/chui_notification/styles_download.css +2 -2
  172. package/framework/components/chui_notification/styles_update.css +3 -3
  173. package/framework/components/chui_org_chart/org_chart.js +101 -62
  174. package/framework/components/chui_org_chart/styles.css +2 -2
  175. package/framework/components/chui_pagination/pagination.js +65 -30
  176. package/framework/components/chui_pagination/styles.css +1 -1
  177. package/framework/components/chui_paragraph/paragraph.js +2 -2
  178. package/framework/components/chui_paragraph/styles.css +3 -3
  179. package/framework/components/chui_popover/popover.js +77 -50
  180. package/framework/components/chui_popover/styles.css +1 -1
  181. package/framework/components/chui_popups/popups.js +210 -181
  182. package/framework/components/chui_popups/styles.css +7 -7
  183. package/framework/components/chui_print_button/print_button.js +48 -33
  184. package/framework/components/chui_progress_bar/progress_bar.js +49 -19
  185. package/framework/components/chui_progress_bar/styles.css +6 -6
  186. package/framework/components/chui_progress_ring/progress_ring.js +32 -30
  187. package/framework/components/chui_progress_ring/styles.css +1 -1
  188. package/framework/components/chui_qrcode/qrcode.js +85 -41
  189. package/framework/components/chui_query_builder/query_builder.js +263 -170
  190. package/framework/components/chui_query_builder/styles.css +4 -4
  191. package/framework/components/chui_radio_group/radio_group.js +36 -26
  192. package/framework/components/chui_radio_group/styles.css +2 -2
  193. package/framework/components/chui_result/result.js +41 -31
  194. package/framework/components/chui_result/styles.css +3 -3
  195. package/framework/components/chui_scheduler/scheduler.js +126 -104
  196. package/framework/components/chui_scheduler/styles.css +11 -7
  197. package/framework/components/chui_screen_spinner/screen_spinner.js +167 -0
  198. package/framework/components/chui_screen_spinner/styles.css +49 -0
  199. package/framework/components/chui_segmented_control/segmented_control.js +90 -27
  200. package/framework/components/chui_segmented_control/styles.css +32 -6
  201. package/framework/components/chui_settings/settings.js +160 -87
  202. package/framework/components/chui_settings/styles.css +4 -4
  203. package/framework/components/chui_shortcut_help/shortcut_help.js +82 -61
  204. package/framework/components/chui_sidebar_nav/sidebar_nav.js +132 -53
  205. package/framework/components/chui_sidebar_nav/styles.css +9 -3
  206. package/framework/components/chui_skeleton/skeleton.js +29 -24
  207. package/framework/components/chui_slideshow/slideshow.js +122 -103
  208. package/framework/components/chui_slideshow/styles.css +22 -16
  209. package/framework/components/chui_spinner/spinner.js +17 -17
  210. package/framework/components/chui_spinner/styles.css +0 -1
  211. package/framework/components/chui_split_button/split_button.js +53 -30
  212. package/framework/components/chui_split_button/styles.css +22 -6
  213. package/framework/components/chui_splitter/splitter.js +46 -39
  214. package/framework/components/chui_splitter/styles.css +2 -2
  215. package/framework/components/chui_statistic/statistic.js +111 -84
  216. package/framework/components/chui_status_bar/status_bar.js +11 -9
  217. package/framework/components/chui_status_bar/styles.css +2 -2
  218. package/framework/components/chui_stepper/stepper.js +230 -54
  219. package/framework/components/chui_stepper/styles.css +79 -14
  220. package/framework/components/chui_sticky_bar/sticky_bar.js +53 -17
  221. package/framework/components/chui_sticky_bar/styles.css +11 -7
  222. package/framework/components/chui_tabs/chui_tabs.js +100 -46
  223. package/framework/components/chui_tabs/styles.css +43 -15
  224. package/framework/components/chui_text_editor/styles.css +24 -23
  225. package/framework/components/chui_text_editor/text_editor.js +103 -79
  226. package/framework/components/chui_text_editor/text_editor_panel.js +428 -367
  227. package/framework/components/chui_theme_toggle/theme_toggle.js +46 -25
  228. package/framework/components/chui_timeline/styles.css +3 -1
  229. package/framework/components/chui_timeline/timeline.js +14 -12
  230. package/framework/components/chui_toast_queue/styles.css +11 -11
  231. package/framework/components/chui_toast_queue/toast_queue.js +82 -73
  232. package/framework/components/chui_toolbar/styles.css +2 -2
  233. package/framework/components/chui_toolbar/toolbar.js +20 -13
  234. package/framework/components/chui_tooltip/styles.css +2 -2
  235. package/framework/components/chui_tooltip/tooltip.js +40 -27
  236. package/framework/components/chui_tour/styles.css +12 -7
  237. package/framework/components/chui_tour/tour.js +132 -98
  238. package/framework/components/chui_transfer/styles.css +8 -7
  239. package/framework/components/chui_transfer/transfer.js +143 -123
  240. package/framework/components/chui_tree_table/styles.css +4 -4
  241. package/framework/components/chui_tree_table/tree_table.js +88 -74
  242. package/framework/components/chui_tree_view/styles.css +14 -10
  243. package/framework/components/chui_tree_view/tree_view.js +298 -253
  244. package/framework/components/chui_user_bar/styles.css +145 -0
  245. package/framework/components/chui_user_bar/user_bar.js +402 -0
  246. package/framework/components/chui_user_list_bar/styles.css +173 -0
  247. package/framework/components/chui_user_list_bar/user_list_bar.js +485 -0
  248. package/framework/components/chui_watermark/watermark.js +41 -33
  249. package/framework/components/chui_webview/styles.css +2 -2
  250. package/framework/components/chui_webview/webview.js +64 -52
  251. package/framework/components/chui_write_bar/styles.css +172 -0
  252. package/framework/components/chui_write_bar/write_bar.js +320 -0
  253. package/framework/main_window.js +1234 -0
  254. package/framework/modules/chui_a11y/chui_a11y.js +153 -123
  255. package/framework/modules/chui_animations/animations.js +105 -43
  256. package/framework/modules/chui_animations/motion.js +120 -0
  257. package/framework/modules/chui_animations/styles.css +37 -4
  258. package/framework/modules/chui_bridge/preload.js +36 -25
  259. package/framework/modules/chui_functions.js +69 -63
  260. package/framework/modules/chui_highlight/chui_highlight.js +25 -22
  261. package/framework/modules/chui_highlight/styles.css +13 -10
  262. package/framework/modules/chui_i18n/chui_i18n.js +12 -10
  263. package/framework/modules/chui_i18n/locales/a11y.js +5 -5
  264. package/framework/modules/chui_i18n/locales/app_layout.js +5 -5
  265. package/framework/modules/chui_i18n/locales/calendar.js +3 -3
  266. package/framework/modules/chui_i18n/locales/common.js +3 -3
  267. package/framework/modules/chui_i18n/locales/data.js +36 -26
  268. package/framework/modules/chui_i18n/locales/editors.js +40 -13
  269. package/framework/modules/chui_i18n/locales/feedback.js +65 -3
  270. package/framework/modules/chui_i18n/locales/forms.js +8 -8
  271. package/framework/modules/chui_i18n/locales/graphics.js +8 -8
  272. package/framework/modules/chui_i18n/locales/media.js +4 -4
  273. package/framework/modules/chui_i18n/locales/navigation.js +12 -8
  274. package/framework/modules/chui_i18n/locales/validate.js +3 -3
  275. package/framework/modules/chui_json/chui_json.js +11 -11
  276. package/framework/modules/chui_layout/chui_layout.js +12 -10
  277. package/framework/modules/chui_logger/chui_logger.js +47 -28
  278. package/framework/modules/chui_page/page.js +39 -33
  279. package/framework/modules/chui_palette/palette.js +61 -0
  280. package/framework/modules/chui_qr/chui_qr.js +179 -88
  281. package/framework/modules/chui_scrollbar/chui_scrollbar.js +79 -68
  282. package/framework/modules/chui_scrollbar/styles.css +4 -2
  283. package/framework/modules/chui_services/chui_channels.js +27 -13
  284. package/framework/modules/chui_services/chui_services.js +47 -39
  285. package/framework/modules/chui_services/desktop.js +108 -101
  286. package/framework/modules/chui_sortable/chui_sortable.js +33 -28
  287. package/framework/modules/chui_validate/chui_validate.js +10 -7
  288. package/framework/tray_bar/chui_menu_items.js +136 -46
  289. package/index.d.ts +5046 -0
  290. package/index.js +199 -1254
  291. package/package.json +81 -68
  292. package/framework/components/telegram_bot/chui_telegram_bot.js +0 -184
@@ -1,9 +1,9 @@
1
1
  const { Icon, Icons } = require("../chui_icons/icons");
2
- const {Label} = require('../chui_label/label');
3
- const {makeKeyboardButton} = require("../../modules/chui_a11y/chui_a11y");
4
- const {Log} = require("../../modules/chui_logger/chui_logger");
5
- const {I18n} = require("../../modules/chui_i18n/chui_i18n");
6
- const {setStyles, optionOr} = require("../../modules/chui_functions");
2
+ const { Label } = require("../chui_label/label");
3
+ const { makeKeyboardButton } = require("../../modules/chui_a11y/chui_a11y");
4
+ const { Log } = require("../../modules/chui_logger/chui_logger");
5
+ const { I18n } = require("../../modules/chui_i18n/chui_i18n");
6
+ const { setStyles, optionOr } = require("../../modules/chui_functions");
7
7
 
8
8
  /**
9
9
  * Видеоплеер: кадр и плавающая полоса управления внутри кадра.
@@ -17,18 +17,18 @@ const {setStyles, optionOr} = require("../../modules/chui_functions");
17
17
  * а события — через `addEventListener()`.
18
18
  */
19
19
  class Video {
20
- #chui_vp_main = document.createElement("chui_vp_main");
21
- #chui_vt = document.createElement("video");
20
+ #chuiVpMain = document.createElement("chui_vp_main");
21
+ #chuiVt = document.createElement("video");
22
22
  // Плавающая полоса управления
23
- #chui_vp_panel = document.createElement("chui_vp_panel");
24
- #chui_vp_play_pause = document.createElement("chui_vp_play_pause");
25
- #chui_vp_time = undefined;
26
- #chui_vp_progress = document.createElement("chui_vp_progress");
27
- #chui_vp_seek = document.createElement("input");
28
- #chui_vp_seek_buf = document.createElement("chui_vp_seek_buf");
29
- #chui_vp_volume_icon = document.createElement("chui_vp_volume_icon");
30
- #chui_vp_volume = document.createElement("input");
31
- #chui_vp_full_mode = document.createElement("chui_vp_full_mode");
23
+ #chuiVpPanel = document.createElement("chui_vp_panel");
24
+ #chuiVpPlayPause = document.createElement("chui_vp_play_pause");
25
+ #chuiVpTime = undefined;
26
+ #chuiVpProgress = document.createElement("chui_vp_progress");
27
+ #chuiVpSeek = document.createElement("input");
28
+ #chuiVpSeekBuf = document.createElement("chui_vp_seek_buf");
29
+ #chuiVpVolumeIcon = document.createElement("chui_vp_volume_icon");
30
+ #chuiVpVolume = document.createElement("input");
31
+ #chuiVpFullMode = document.createElement("chui_vp_full_mode");
32
32
  // Состояние
33
33
  #controls = true;
34
34
  #destroyed = false;
@@ -36,58 +36,71 @@ class Video {
36
36
  #onPlay = () => this.#renderPlayState(true);
37
37
  #onPause = () => this.#renderPlayState(false);
38
38
  #onTimeUpdate = () => this.#renderProgress();
39
- #onDurationChange = () => { this.#setSliderMax(); this.#renderProgress(); };
39
+ #onDurationChange = () => {
40
+ this.#setSliderMax();
41
+ this.#renderProgress();
42
+ };
40
43
  #onBuffered = () => this.#displayBufferedAmount();
41
44
  #onEnter = () => this.#openPanel();
42
45
  #onLeave = () => this.#closePanel();
43
- constructor(options = {
44
- src: String(), autoplay: Boolean(), controls: Boolean(), loop: Boolean(), muted: Boolean(),
45
- volume: Number(), poster: String(), width: String(), height: String(), label: String()
46
- }) {
47
- setStyles(__dirname + "/video_styles.css", 'chUiJS_Video');
46
+ constructor(
47
+ options = {
48
+ src: String(),
49
+ autoplay: Boolean(),
50
+ controls: Boolean(),
51
+ loop: Boolean(),
52
+ muted: Boolean(),
53
+ volume: Number(),
54
+ poster: String(),
55
+ width: String(),
56
+ height: String(),
57
+ label: String(),
58
+ }
59
+ ) {
60
+ setStyles(__dirname + "/video_styles.css", "chUiJS_Video");
48
61
  // Плеер — именованная группа: своих ролей у панели нет, а без имени скринридер
49
62
  // читает подряд безымянные кнопки без контекста
50
- this.#chui_vp_main.setAttribute("role", "group");
51
- this.#chui_vp_main.setAttribute("aria-label", optionOr(options.label, I18n.t("media.videoPlayer")));
52
- this.#chui_vt.preload = "metadata";
53
- this.#chui_vt.controls = false;
54
- if (options.src !== undefined) this.#chui_vt.setAttribute("src", options.src);
55
- if (options.poster !== undefined) this.#chui_vt.setAttribute("poster", options.poster);
56
- if (options.autoplay !== undefined) this.#chui_vt.autoplay = options.autoplay === true;
57
- if (options.loop !== undefined) this.#chui_vt.loop = options.loop === true;
58
- if (options.muted !== undefined) this.#chui_vt.muted = options.muted === true;
59
- this.#chui_vt.volume = options.volume === undefined ? 0.5 : Math.min(1, Math.max(0, Number(options.volume)));
63
+ this.#chuiVpMain.setAttribute("role", "group");
64
+ this.#chuiVpMain.setAttribute("aria-label", optionOr(options.label, I18n.t("media.videoPlayer")));
65
+ this.#chuiVt.preload = "metadata";
66
+ this.#chuiVt.controls = false;
67
+ if (options.src !== undefined) this.#chuiVt.setAttribute("src", options.src);
68
+ if (options.poster !== undefined) this.#chuiVt.setAttribute("poster", options.poster);
69
+ if (options.autoplay !== undefined) this.#chuiVt.autoplay = options.autoplay === true;
70
+ if (options.loop !== undefined) this.#chuiVt.loop = options.loop === true;
71
+ if (options.muted !== undefined) this.#chuiVt.muted = options.muted === true;
72
+ this.#chuiVt.volume = options.volume === undefined ? 0.5 : Math.min(1, Math.max(0, Number(options.volume)));
60
73
  // Размеры кадра — стилем: опции принимают и проценты, и `-webkit-fill-available`
61
- if (options.width !== undefined) this.#chui_vt.style.width = options.width;
62
- if (options.height !== undefined) this.#chui_vt.style.height = options.height;
63
- this.#chui_vp_main.appendChild(this.#chui_vt);
74
+ if (options.width !== undefined) this.#chuiVt.style.width = options.width;
75
+ if (options.height !== undefined) this.#chuiVt.style.height = options.height;
76
+ this.#chuiVpMain.appendChild(this.#chuiVt);
64
77
  this.#buildPanel();
65
- this.#chui_vp_main.appendChild(this.#chui_vp_panel);
78
+ this.#chuiVpMain.appendChild(this.#chuiVpPanel);
66
79
  // О смене состояния и ошибках сообщает скрытый live-регион
67
80
  this.#status.classList.add("chui_visually_hidden");
68
81
  this.#status.setAttribute("role", "status");
69
82
  this.#status.setAttribute("aria-live", "polite");
70
- this.#chui_vp_main.appendChild(this.#status);
83
+ this.#chuiVpMain.appendChild(this.#status);
71
84
  // СОБЫТИЯ
72
- this.#chui_vt.addEventListener("play", this.#onPlay);
73
- this.#chui_vt.addEventListener("pause", this.#onPause);
74
- this.#chui_vt.addEventListener("timeupdate", this.#onTimeUpdate);
75
- this.#chui_vt.addEventListener("durationchange", this.#onDurationChange);
76
- this.#chui_vt.addEventListener("loadedmetadata", this.#onDurationChange);
77
- this.#chui_vt.addEventListener("progress", this.#onBuffered);
78
- this.#chui_vt.addEventListener("volumechange", () => this.#renderVolume());
79
- this.#chui_vt.addEventListener("error", () => {
85
+ this.#chuiVt.addEventListener("play", this.#onPlay);
86
+ this.#chuiVt.addEventListener("pause", this.#onPause);
87
+ this.#chuiVt.addEventListener("timeupdate", this.#onTimeUpdate);
88
+ this.#chuiVt.addEventListener("durationchange", this.#onDurationChange);
89
+ this.#chuiVt.addEventListener("loadedmetadata", this.#onDurationChange);
90
+ this.#chuiVt.addEventListener("progress", this.#onBuffered);
91
+ this.#chuiVt.addEventListener("volumechange", () => this.#renderVolume());
92
+ this.#chuiVt.addEventListener("error", () => {
80
93
  Log.error(`[Video] не удалось прочитать дорожку: ${this.getSrc()}`);
81
- this.#setStatus(I18n.t("media.videoNotPlaying", {reason: I18n.t("media.error.sourceFailed")}));
94
+ this.#setStatus(I18n.t("media.videoNotPlaying", { reason: I18n.t("media.error.sourceFailed") }));
82
95
  });
83
- this.#chui_vp_main.addEventListener("mouseenter", this.#onEnter);
84
- this.#chui_vp_main.addEventListener("mouseleave", this.#onLeave);
96
+ this.#chuiVpMain.addEventListener("mouseenter", this.#onEnter);
97
+ this.#chuiVpMain.addEventListener("mouseleave", this.#onLeave);
85
98
  // Панель не должна прятаться, пока в ней стоит клавиатурный фокус
86
- this.#chui_vp_main.addEventListener("focusin", this.#onEnter);
87
- this.#chui_vp_main.addEventListener("focusout", this.#onLeave);
88
- this.#chui_vp_play_pause.addEventListener("click", () => this.#playPause());
89
- this.#chui_vp_volume_icon.addEventListener("click", () => this.setMuted(!this.getMuted()));
90
- this.#chui_vp_full_mode.addEventListener("click", () => this.#toggleFullscreen());
99
+ this.#chuiVpMain.addEventListener("focusin", this.#onEnter);
100
+ this.#chuiVpMain.addEventListener("focusout", this.#onLeave);
101
+ this.#chuiVpPlayPause.addEventListener("click", () => this.#playPause());
102
+ this.#chuiVpVolumeIcon.addEventListener("click", () => this.setMuted(!this.getMuted()));
103
+ this.#chuiVpFullMode.addEventListener("click", () => this.#toggleFullscreen());
91
104
  this.#setSliderMax();
92
105
  this.setControls(options.controls === undefined ? true : options.controls === true);
93
106
  this.#renderPlayState(false);
@@ -95,117 +108,123 @@ class Video {
95
108
  }
96
109
  /** Полоса управления: кнопки, полоса прогресса, время, громкость, полный экран */
97
110
  #buildPanel() {
98
- this.#setButton(this.#chui_vp_play_pause, I18n.t("media.play"), Icons.AUDIO_VIDEO.PLAY_ARROW);
99
- this.#setButton(this.#chui_vp_volume_icon, I18n.t("media.mute"), Icons.AUDIO_VIDEO.VOLUME_UP);
100
- this.#setButton(this.#chui_vp_full_mode, I18n.t("media.fullscreen"), Icons.NAVIGATION.FULLSCREEN);
101
- this.#chui_vp_time = new Label({text: this.#calculateTime(0)});
102
- this.#chui_vp_seek.type = "range";
103
- this.#chui_vp_seek.id = "chui_vp_seek";
104
- this.#chui_vp_seek.max = "0";
105
- this.#chui_vp_seek.value = "0";
106
- this.#chui_vp_seek.setAttribute("aria-label", I18n.t("media.position"));
107
- this.#chui_vp_seek.addEventListener("input", () => {
108
- this.#chui_vt.currentTime = Number(this.#chui_vp_seek.value);
111
+ this.#setButton(this.#chuiVpPlayPause, I18n.t("media.play"), Icons.AUDIO_VIDEO.PLAY_ARROW);
112
+ this.#setButton(this.#chuiVpVolumeIcon, I18n.t("media.mute"), Icons.AUDIO_VIDEO.VOLUME_UP);
113
+ this.#setButton(this.#chuiVpFullMode, I18n.t("media.fullscreen"), Icons.NAVIGATION.FULLSCREEN);
114
+ this.#chuiVpTime = new Label({ text: this.#calculateTime(0) });
115
+ this.#chuiVpSeek.type = "range";
116
+ this.#chuiVpSeek.id = "chui_vp_seek";
117
+ this.#chuiVpSeek.max = "0";
118
+ this.#chuiVpSeek.value = "0";
119
+ this.#chuiVpSeek.setAttribute("aria-label", I18n.t("media.position"));
120
+ this.#chuiVpSeek.addEventListener("input", () => {
121
+ this.#chuiVt.currentTime = Number(this.#chuiVpSeek.value);
109
122
  this.#renderProgress();
110
123
  });
111
- this.#chui_vp_progress.appendChild(this.#chui_vp_seek);
112
- this.#chui_vp_progress.appendChild(this.#chui_vp_seek_buf);
113
- this.#chui_vp_volume.type = "range";
114
- this.#chui_vp_volume.id = "chui_vp_volume";
115
- this.#chui_vp_volume.max = "100";
116
- this.#chui_vp_volume.value = String(Math.round(this.#chui_vt.volume * 100));
117
- this.#chui_vp_volume.setAttribute("aria-label", I18n.t("media.volume"));
118
- this.#chui_vp_volume.addEventListener("input", () => {
119
- this.#chui_vt.volume = Number(this.#chui_vp_volume.value) / 100;
120
- this.#chui_vt.muted = false;
124
+ this.#chuiVpProgress.appendChild(this.#chuiVpSeek);
125
+ this.#chuiVpProgress.appendChild(this.#chuiVpSeekBuf);
126
+ this.#chuiVpVolume.type = "range";
127
+ this.#chuiVpVolume.id = "chui_vp_volume";
128
+ this.#chuiVpVolume.max = "100";
129
+ this.#chuiVpVolume.value = String(Math.round(this.#chuiVt.volume * 100));
130
+ this.#chuiVpVolume.setAttribute("aria-label", I18n.t("media.volume"));
131
+ this.#chuiVpVolume.addEventListener("input", () => {
132
+ this.#chuiVt.volume = Number(this.#chuiVpVolume.value) / 100;
133
+ this.#chuiVt.muted = false;
121
134
  });
122
135
  //
123
- this.#chui_vp_panel.appendChild(this.#chui_vp_play_pause);
124
- this.#chui_vp_panel.appendChild(this.#chui_vp_progress);
125
- this.#chui_vp_panel.appendChild(this.#chui_vp_time.set());
126
- this.#chui_vp_panel.appendChild(this.#chui_vp_volume_icon);
127
- this.#chui_vp_panel.appendChild(this.#chui_vp_volume);
128
- this.#chui_vp_panel.appendChild(this.#chui_vp_full_mode);
136
+ this.#chuiVpPanel.appendChild(this.#chuiVpPlayPause);
137
+ this.#chuiVpPanel.appendChild(this.#chuiVpProgress);
138
+ this.#chuiVpPanel.appendChild(this.#chuiVpTime.set());
139
+ this.#chuiVpPanel.appendChild(this.#chuiVpVolumeIcon);
140
+ this.#chuiVpPanel.appendChild(this.#chuiVpVolume);
141
+ this.#chuiVpPanel.appendChild(this.#chuiVpFullMode);
129
142
  }
130
143
  // === ПАНЕЛЬ И ПОЛОСЫ ===
131
144
  /** Полоса показывается, пока курсор над плеером или фокус в нём (состояние — класс) */
132
145
  #openPanel() {
133
146
  if (!this.#controls) return;
134
- this.#chui_vp_main.classList.add("vp_panel_open");
147
+ this.#chuiVpMain.classList.add("vp_panel_open");
148
+ }
149
+ #closePanel() {
150
+ this.#chuiVpMain.classList.remove("vp_panel_open");
135
151
  }
136
- #closePanel() { this.#chui_vp_main.classList.remove("vp_panel_open"); }
137
152
  #playPause = async () => {
138
153
  if (this.getPaused()) await this.play();
139
154
  else this.pause();
140
- }
155
+ };
141
156
  #toggleFullscreen = async () => {
142
157
  if (document.fullscreenElement === null) await this.requestFullscreen();
143
158
  else await this.exitFullscreen();
144
- }
159
+ };
145
160
  #renderPlayState(playing) {
146
- this.#setIcon(this.#chui_vp_play_pause, playing ? Icons.AUDIO_VIDEO.PAUSE : Icons.AUDIO_VIDEO.PLAY_ARROW);
147
- this.#setLabel(this.#chui_vp_play_pause, playing ? I18n.t("media.pause") : I18n.t("media.play"));
161
+ this.#setIcon(this.#chuiVpPlayPause, playing ? Icons.AUDIO_VIDEO.PAUSE : Icons.AUDIO_VIDEO.PLAY_ARROW);
162
+ this.#setLabel(this.#chuiVpPlayPause, playing ? I18n.t("media.pause") : I18n.t("media.play"));
148
163
  }
149
164
  #renderVolume = () => {
150
- const доля = Math.min(100, Math.max(0, Math.round(this.#chui_vt.volume * 100)));
151
- this.#chui_vp_volume.value = String(доля);
152
- this.#chui_vp_volume.disabled = this.getMuted();
153
- this.#chui_vp_main.style.setProperty('--volume-before-width', `${доля}%`);
154
- this.#setIcon(this.#chui_vp_volume_icon, this.getMuted() || this.#chui_vt.volume === 0
155
- ? Icons.AUDIO_VIDEO.VOLUME_OFF : Icons.AUDIO_VIDEO.VOLUME_UP);
156
- this.#chui_vp_volume_icon.setAttribute("aria-label", I18n.t(this.getMuted() ? "media.unmute" : "media.mute"));
157
- }
165
+ const доля = Math.min(100, Math.max(0, Math.round(this.#chuiVt.volume * 100)));
166
+ this.#chuiVpVolume.value = String(доля);
167
+ this.#chuiVpVolume.disabled = this.getMuted();
168
+ this.#chuiVpMain.style.setProperty("--volume_before_width", `${доля}%`);
169
+ this.#setIcon(
170
+ this.#chuiVpVolumeIcon,
171
+ this.getMuted() || this.#chuiVt.volume === 0 ? Icons.AUDIO_VIDEO.VOLUME_OFF : Icons.AUDIO_VIDEO.VOLUME_UP
172
+ );
173
+ this.#chuiVpVolumeIcon.setAttribute("aria-label", I18n.t(this.getMuted() ? "media.unmute" : "media.mute"));
174
+ };
158
175
  #displayBufferedAmount = () => {
159
- const max = Number(this.#chui_vp_seek.max);
176
+ const max = Number(this.#chuiVpSeek.max);
160
177
  if (!(max > 0)) return;
161
178
  try {
162
- const end = Math.floor(this.#chui_vt.buffered.end(0) / max * 100);
163
- this.#chui_vp_seek_buf.style.width = `${Math.min(100, Math.max(0, end))}%`;
179
+ const end = Math.floor((this.#chuiVt.buffered.end(0) / max) * 100);
180
+ this.#chuiVpSeekBuf.style.width = `${Math.min(100, Math.max(0, end))}%`;
164
181
  } catch (_error) {
165
182
  // Буфер ещё пуст — рисовать нечего
166
183
  }
167
- }
184
+ };
168
185
  // Длительность приходит с метаданными: без неё полоса прокрутки делила бы на ноль,
169
186
  // а у живого потока её нет вовсе (duration = Infinity)
170
187
  #setSliderMax = () => {
171
188
  const duration = this.getDuration();
172
189
  const known = Number.isFinite(duration) && duration > 0;
173
- this.#chui_vp_seek.max = known ? String(Math.floor(duration)) : "0";
190
+ this.#chuiVpSeek.max = known ? String(Math.floor(duration)) : "0";
174
191
  // Без известной длительности ползунок бессмысленен: перетаскивание отправляло бы плеер в начало
175
- this.#chui_vp_seek.disabled = !known;
176
- }
192
+ this.#chuiVpSeek.disabled = !known;
193
+ };
177
194
  #renderProgress = () => {
178
- const max = Number(this.#chui_vp_seek.max);
195
+ const max = Number(this.#chuiVpSeek.max);
179
196
  const position = this.getCurrentTime();
180
197
  const duration = this.getDuration();
181
198
  if (!(max > 0)) {
182
199
  // «0:07 / 0:00» читалось бы как поломка: у источника без длительности показываем только прошедшее
183
- this.#chui_vp_time.setText(this.#calculateTime(position));
184
- this.#chui_vp_main.style.setProperty('--seek-before-width', '0%');
200
+ this.#chuiVpTime.setText(this.#calculateTime(position));
201
+ this.#chuiVpMain.style.setProperty("--seek_before_width", "0%");
185
202
  return;
186
203
  }
187
- this.#chui_vp_time.setText(`${this.#calculateTime(position)} / ${this.#calculateTime(duration)}`);
188
- this.#chui_vp_seek.value = String(Math.floor(position));
204
+ this.#chuiVpTime.setText(`${this.#calculateTime(position)} / ${this.#calculateTime(duration)}`);
205
+ this.#chuiVpSeek.value = String(Math.floor(position));
189
206
  // Доля ограничена сотней: `max` — округлённая длительность, а позиция идёт дальше,
190
207
  // и без ограничения полоса целиком заливалась акцентом
191
- const доля = Math.min(100, Math.max(0, Math.floor(position / max * 100)));
192
- this.#chui_vp_main.style.setProperty('--seek-before-width', `${доля}%`);
193
- }
208
+ const доля = Math.min(100, Math.max(0, Math.floor((position / max) * 100)));
209
+ this.#chuiVpMain.style.setProperty("--seek_before_width", `${доля}%`);
210
+ };
194
211
  #calculateTime = (secs) => {
195
212
  const seconds = Number.isFinite(Number(secs)) ? Number(secs) : 0;
196
213
  const minutes = Math.floor(seconds / 60);
197
214
  const rest = Math.floor(seconds % 60);
198
215
  const returnedSeconds = rest < 10 ? `0${rest}` : `${rest}`;
199
216
  return `${minutes}:${returnedSeconds}`;
217
+ };
218
+ #setStatus(text) {
219
+ this.#status.innerText = text;
200
220
  }
201
- #setStatus(text) { this.#status.innerText = text; }
202
221
  #setButton(node, label, icon) {
203
- node.innerHTML = new Icon(icon, "18px").getHTML();
222
+ node.innerHTML = new Icon(icon).getHTML();
204
223
  node.setAttribute("aria-label", label);
205
224
  makeKeyboardButton(node);
206
225
  }
207
- #setIcon(node, icon, size = "18px") {
208
- const glyph = new Icon(icon, size).getHTML();
226
+ #setIcon(node, icon) {
227
+ const glyph = new Icon(icon).getHTML();
209
228
  if (node.innerHTML !== glyph) node.innerHTML = glyph;
210
229
  }
211
230
  #setLabel(node, label) {
@@ -216,87 +235,161 @@ class Video {
216
235
  /** Полоса управления: `false` — панели нет вовсе, остаётся только кадр */
217
236
  setControls(boolean = Boolean()) {
218
237
  this.#controls = boolean === true;
219
- this.#chui_vp_main.classList.toggle("vp_controls_off", !this.#controls);
238
+ this.#chuiVpMain.classList.toggle("vp_controls_off", !this.#controls);
220
239
  if (!this.#controls) this.#closePanel();
221
240
  return this;
222
241
  }
223
- getControls() { return this.#controls; }
242
+ getControls() {
243
+ return this.#controls;
244
+ }
224
245
  // === СТАНДАРТНЫЕ ВОЗМОЖНОСТИ `<video>` ===
225
246
  /** Сам элемент: для всего, чего нет в списке ниже */
226
- getVideo() { return this.#chui_vt; }
247
+ getVideo() {
248
+ return this.#chuiVt;
249
+ }
227
250
  /** Воспроизведение: промис, как у `<video>` (разрешается, когда воспроизведение началось) */
228
- play() { return this.#chui_vt.play(); }
229
- pause() { this.#chui_vt.pause(); return this; }
230
- load() { this.#chui_vt.load(); return this; }
231
- canPlayType(type = String()) { return this.#chui_vt.canPlayType(type); }
232
- getSrc() { return this.#chui_vt.getAttribute("src") ?? ""; }
251
+ play() {
252
+ return this.#chuiVt.play();
253
+ }
254
+ pause() {
255
+ this.#chuiVt.pause();
256
+ return this;
257
+ }
258
+ load() {
259
+ this.#chuiVt.load();
260
+ return this;
261
+ }
262
+ canPlayType(type = String()) {
263
+ return this.#chuiVt.canPlayType(type);
264
+ }
265
+ getSrc() {
266
+ return this.#chuiVt.getAttribute("src") ?? "";
267
+ }
233
268
  setSrc(url = String()) {
234
- this.#chui_vt.setAttribute("src", url);
235
- this.#chui_vt.load();
269
+ this.#chuiVt.setAttribute("src", url);
270
+ this.#chuiVt.load();
236
271
  return this;
237
272
  }
238
- getSrcObject() { return this.#chui_vt.srcObject; }
273
+ getSrcObject() {
274
+ return this.#chuiVt.srcObject;
275
+ }
239
276
  /** Живой поток (камера, `getUserMedia`) — штатное `srcObject`, а не путь */
240
277
  setSrcObject(object) {
241
- this.#chui_vt.srcObject = object;
278
+ this.#chuiVt.srcObject = object;
242
279
  return this;
243
280
  }
244
- getPoster() { return this.#chui_vt.getAttribute("poster") ?? ""; }
281
+ getPoster() {
282
+ return this.#chuiVt.getAttribute("poster") ?? "";
283
+ }
245
284
  setPoster(url = String()) {
246
- if (url === "") this.#chui_vt.removeAttribute("poster");
247
- else this.#chui_vt.setAttribute("poster", url);
285
+ if (url === "") this.#chuiVt.removeAttribute("poster");
286
+ else this.#chuiVt.setAttribute("poster", url);
248
287
  return this;
249
288
  }
250
- getCurrentTime() { return this.#chui_vt.currentTime; }
289
+ getCurrentTime() {
290
+ return this.#chuiVt.currentTime;
291
+ }
251
292
  setCurrentTime(seconds = Number()) {
252
- this.#chui_vt.currentTime = Number(seconds);
293
+ this.#chuiVt.currentTime = Number(seconds);
253
294
  // Подписи и заливка не ждут `timeupdate`: перемотка из кода видна сразу
254
295
  this.#renderProgress();
255
296
  return this;
256
297
  }
257
- getDuration() { return this.#chui_vt.duration; }
258
- getBuffered() { return this.#chui_vt.buffered; }
259
- getPaused() { return this.#chui_vt.paused; }
260
- getEnded() { return this.#chui_vt.ended; }
261
- getReadyState() { return this.#chui_vt.readyState; }
262
- getVolume() { return this.#chui_vt.volume; }
298
+ getDuration() {
299
+ return this.#chuiVt.duration;
300
+ }
301
+ getBuffered() {
302
+ return this.#chuiVt.buffered;
303
+ }
304
+ getPaused() {
305
+ return this.#chuiVt.paused;
306
+ }
307
+ getEnded() {
308
+ return this.#chuiVt.ended;
309
+ }
310
+ getReadyState() {
311
+ return this.#chuiVt.readyState;
312
+ }
313
+ getVolume() {
314
+ return this.#chuiVt.volume;
315
+ }
263
316
  setVolume(value = Number()) {
264
- this.#chui_vt.volume = Math.min(1, Math.max(0, Number(value)));
317
+ this.#chuiVt.volume = Math.min(1, Math.max(0, Number(value)));
265
318
  return this;
266
319
  }
267
- getMuted() { return this.#chui_vt.muted; }
320
+ getMuted() {
321
+ return this.#chuiVt.muted;
322
+ }
268
323
  setMuted(boolean = Boolean()) {
269
- this.#chui_vt.muted = boolean === true;
324
+ this.#chuiVt.muted = boolean === true;
270
325
  return this;
271
326
  }
272
- getPlaybackRate() { return this.#chui_vt.playbackRate; }
273
- setPlaybackRate(rate = Number()) { this.#chui_vt.playbackRate = Number(rate); return this; }
274
- getDefaultPlaybackRate() { return this.#chui_vt.defaultPlaybackRate; }
275
- setDefaultPlaybackRate(rate = Number()) { this.#chui_vt.defaultPlaybackRate = Number(rate); return this; }
276
- getLoop() { return this.#chui_vt.loop; }
277
- setLoop(boolean = Boolean()) { this.#chui_vt.loop = boolean === true; return this; }
278
- getAutoplay() { return this.#chui_vt.autoplay; }
279
- setAutoplay(boolean = Boolean()) { this.#chui_vt.autoplay = boolean === true; return this; }
280
- getWidth() { return getComputedStyle(this.#chui_vt).width; }
281
- setWidth(value = String()) { this.#chui_vt.style.width = value; return this; }
282
- getHeight() { return getComputedStyle(this.#chui_vt).height; }
283
- setHeight(value = String()) { this.#chui_vt.style.height = value; return this; }
284
- getFullscreen() { return this.#chui_vp_main === document.fullscreenElement; }
327
+ getPlaybackRate() {
328
+ return this.#chuiVt.playbackRate;
329
+ }
330
+ setPlaybackRate(rate = Number()) {
331
+ this.#chuiVt.playbackRate = Number(rate);
332
+ return this;
333
+ }
334
+ getDefaultPlaybackRate() {
335
+ return this.#chuiVt.defaultPlaybackRate;
336
+ }
337
+ setDefaultPlaybackRate(rate = Number()) {
338
+ this.#chuiVt.defaultPlaybackRate = Number(rate);
339
+ return this;
340
+ }
341
+ getLoop() {
342
+ return this.#chuiVt.loop;
343
+ }
344
+ setLoop(boolean = Boolean()) {
345
+ this.#chuiVt.loop = boolean === true;
346
+ return this;
347
+ }
348
+ getAutoplay() {
349
+ return this.#chuiVt.autoplay;
350
+ }
351
+ setAutoplay(boolean = Boolean()) {
352
+ this.#chuiVt.autoplay = boolean === true;
353
+ return this;
354
+ }
355
+ getWidth() {
356
+ return getComputedStyle(this.#chuiVt).width;
357
+ }
358
+ setWidth(value = String()) {
359
+ this.#chuiVt.style.width = value;
360
+ return this;
361
+ }
362
+ getHeight() {
363
+ return getComputedStyle(this.#chuiVt).height;
364
+ }
365
+ setHeight(value = String()) {
366
+ this.#chuiVt.style.height = value;
367
+ return this;
368
+ }
369
+ getFullscreen() {
370
+ return this.#chuiVpMain === document.fullscreenElement;
371
+ }
285
372
  /** Полный экран — на весь плеер, а не на кадр: иначе полоса управления осталась бы снаружи */
286
- requestFullscreen() { return this.#chui_vp_main.requestFullscreen({ navigationUI: "hide" }); }
287
- exitFullscreen() { return document.exitFullscreen(); }
373
+ requestFullscreen() {
374
+ return this.#chuiVpMain.requestFullscreen({ navigationUI: "hide" });
375
+ }
376
+ exitFullscreen() {
377
+ return document.exitFullscreen();
378
+ }
288
379
  addEventListener(type = String(), listener = () => {}) {
289
- this.#chui_vt.addEventListener(type, listener);
380
+ this.#chuiVt.addEventListener(type, listener);
290
381
  return this;
291
382
  }
292
383
  removeEventListener(type = String(), listener = () => {}) {
293
- this.#chui_vt.removeEventListener(type, listener);
384
+ this.#chuiVt.removeEventListener(type, listener);
294
385
  return this;
295
386
  }
296
- set() { return this.#chui_vp_main; }
387
+ set() {
388
+ return this.#chuiVpMain;
389
+ }
297
390
  detach() {
298
391
  this.pause();
299
- this.#chui_vp_main.remove();
392
+ this.#chuiVpMain.remove();
300
393
  return this;
301
394
  }
302
395
  /** Остановить плеер и снять свои обработчики. Повторный вызов безопасен */
@@ -304,20 +397,20 @@ class Video {
304
397
  if (this.#destroyed) return this;
305
398
  this.#destroyed = true;
306
399
  this.pause();
307
- this.#chui_vt.removeEventListener("play", this.#onPlay);
308
- this.#chui_vt.removeEventListener("pause", this.#onPause);
309
- this.#chui_vt.removeEventListener("timeupdate", this.#onTimeUpdate);
310
- this.#chui_vt.removeEventListener("durationchange", this.#onDurationChange);
311
- this.#chui_vt.removeEventListener("loadedmetadata", this.#onDurationChange);
312
- this.#chui_vt.removeEventListener("progress", this.#onBuffered);
313
- this.#chui_vp_main.removeEventListener("mouseenter", this.#onEnter);
314
- this.#chui_vp_main.removeEventListener("mouseleave", this.#onLeave);
315
- this.#chui_vp_main.removeEventListener("focusin", this.#onEnter);
316
- this.#chui_vp_main.removeEventListener("focusout", this.#onLeave);
317
- this.#chui_vt.removeAttribute("src");
318
- this.#chui_vt.load();
400
+ this.#chuiVt.removeEventListener("play", this.#onPlay);
401
+ this.#chuiVt.removeEventListener("pause", this.#onPause);
402
+ this.#chuiVt.removeEventListener("timeupdate", this.#onTimeUpdate);
403
+ this.#chuiVt.removeEventListener("durationchange", this.#onDurationChange);
404
+ this.#chuiVt.removeEventListener("loadedmetadata", this.#onDurationChange);
405
+ this.#chuiVt.removeEventListener("progress", this.#onBuffered);
406
+ this.#chuiVpMain.removeEventListener("mouseenter", this.#onEnter);
407
+ this.#chuiVpMain.removeEventListener("mouseleave", this.#onLeave);
408
+ this.#chuiVpMain.removeEventListener("focusin", this.#onEnter);
409
+ this.#chuiVpMain.removeEventListener("focusout", this.#onLeave);
410
+ this.#chuiVt.removeAttribute("src");
411
+ this.#chuiVt.load();
319
412
  return this;
320
413
  }
321
414
  }
322
415
 
323
- exports.Video = Video
416
+ exports.Video = Video;