@enact/limestone 1.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 (463) hide show
  1. package/.github/PULL_REQUEST_TEMPLATE.md +28 -0
  2. package/.github/workflows/update-copyright-years.yml +25 -0
  3. package/.travis.yml +40 -0
  4. package/ActionGuide/ActionGuide.d.ts +73 -0
  5. package/ActionGuide/ActionGuide.js +164 -0
  6. package/ActionGuide/ActionGuide.module.css +73 -0
  7. package/ActionGuide/package.json +3 -0
  8. package/ActionGuide/tests/ActionGuide-specs.js +51 -0
  9. package/Alert/Alert.d.ts +155 -0
  10. package/Alert/Alert.js +313 -0
  11. package/Alert/Alert.module.css +190 -0
  12. package/Alert/AlertImage.js +102 -0
  13. package/Alert/AlertImage.module.css +15 -0
  14. package/Alert/package.json +3 -0
  15. package/Alert/tests/Alert-specs.js +204 -0
  16. package/BodyText/BodyText.d.ts +74 -0
  17. package/BodyText/BodyText.js +170 -0
  18. package/BodyText/BodyText.module.css +95 -0
  19. package/BodyText/package.json +3 -0
  20. package/BodyText/tests/BodyText-specs.js +55 -0
  21. package/Button/Button.d.ts +131 -0
  22. package/Button/Button.js +351 -0
  23. package/Button/Button.module.css +2518 -0
  24. package/Button/package.json +3 -0
  25. package/Button/tests/Button-specs.js +252 -0
  26. package/CHANGELOG.md +170 -0
  27. package/Card/Card.d.ts +138 -0
  28. package/Card/Card.js +396 -0
  29. package/Card/Card.module.css +1296 -0
  30. package/Card/package.json +3 -0
  31. package/Card/tests/Card-specs.js +65 -0
  32. package/Checkbox/Checkbox.d.ts +99 -0
  33. package/Checkbox/Checkbox.js +222 -0
  34. package/Checkbox/Checkbox.module.css +1395 -0
  35. package/Checkbox/package.json +3 -0
  36. package/Checkbox/tests/Checkbox-specs.js +79 -0
  37. package/CheckboxItem/CheckboxItem.d.ts +99 -0
  38. package/CheckboxItem/CheckboxItem.js +210 -0
  39. package/CheckboxItem/CheckboxItem.module.css +50 -0
  40. package/CheckboxItem/package.json +3 -0
  41. package/CheckboxItem/tests/CheckboxItem-specs.js +52 -0
  42. package/Chips/Chip.js +252 -0
  43. package/Chips/Chip.module.css +30 -0
  44. package/Chips/Chips.js +215 -0
  45. package/Chips/Chips.module.css +8 -0
  46. package/Chips/index.js +86 -0
  47. package/Chips/tests/Chip-specs.js +186 -0
  48. package/Chips/tests/Chips-specs.js +312 -0
  49. package/ColorPicker/ColorPicker.js +416 -0
  50. package/ColorPicker/ColorPicker.module.css +78 -0
  51. package/ColorPicker/package.json +3 -0
  52. package/ColorPicker/tests/ColorPicker-specs.js +225 -0
  53. package/ColorPicker/utils.js +135 -0
  54. package/ContextualMenuDecorator/ContextualMenuDecorator.d.ts +106 -0
  55. package/ContextualMenuDecorator/ContextualMenuDecorator.js +264 -0
  56. package/ContextualMenuDecorator/ContextualMenuDecorator.module.css +42 -0
  57. package/ContextualMenuDecorator/package.json +3 -0
  58. package/ContextualMenuDecorator/tests/ContextualMenuDecorator-specs.js +136 -0
  59. package/ContextualPopupDecorator/ContextualPopup.js +200 -0
  60. package/ContextualPopupDecorator/ContextualPopup.module.css +270 -0
  61. package/ContextualPopupDecorator/ContextualPopupDecorator.d.ts +182 -0
  62. package/ContextualPopupDecorator/ContextualPopupDecorator.js +867 -0
  63. package/ContextualPopupDecorator/ContextualPopupDecorator.module.css +3 -0
  64. package/ContextualPopupDecorator/HolePunchScrim.js +69 -0
  65. package/ContextualPopupDecorator/HolePunchScrim.module.css +38 -0
  66. package/ContextualPopupDecorator/package.json +3 -0
  67. package/ContextualPopupDecorator/tests/ContextualPopupDecorator-specs.js +621 -0
  68. package/DatePicker/DatePicker.d.ts +173 -0
  69. package/DatePicker/DatePicker.js +175 -0
  70. package/DatePicker/DatePicker.module.css +5 -0
  71. package/DatePicker/DatePickerBase.js +348 -0
  72. package/DatePicker/package.json +3 -0
  73. package/DatePicker/tests/DatePicker-specs.js +247 -0
  74. package/DayPicker/DayPicker.d.ts +92 -0
  75. package/DayPicker/DayPicker.js +188 -0
  76. package/DayPicker/DayPicker.module.css +35 -0
  77. package/DayPicker/DaySelectorDecorator.js +301 -0
  78. package/DayPicker/package.json +3 -0
  79. package/DayPicker/tests/DayPicker-specs.js +138 -0
  80. package/Dropdown/Dropdown.d.ts +135 -0
  81. package/Dropdown/Dropdown.js +460 -0
  82. package/Dropdown/Dropdown.module.css +160 -0
  83. package/Dropdown/DropdownList.js +360 -0
  84. package/Dropdown/package.json +3 -0
  85. package/Dropdown/tests/Dropdown-specs.js +267 -0
  86. package/FixedPopupPanels/FixedPopupPanels.d.ts +72 -0
  87. package/FixedPopupPanels/FixedPopupPanels.js +170 -0
  88. package/FixedPopupPanels/FixedPopupPanels.module.css +146 -0
  89. package/FixedPopupPanels/package.json +3 -0
  90. package/FixedPopupPanels/tests/FixedPopupPanels-specs.js +142 -0
  91. package/FlexiblePopupPanels/FlexiblePopupPanels.js +177 -0
  92. package/FlexiblePopupPanels/FlexiblePopupPanels.module.css +291 -0
  93. package/FlexiblePopupPanels/Header.js +110 -0
  94. package/FlexiblePopupPanels/Panel.js +256 -0
  95. package/FlexiblePopupPanels/index.d.ts +145 -0
  96. package/FlexiblePopupPanels/index.js +68 -0
  97. package/FlexiblePopupPanels/package.json +3 -0
  98. package/FlexiblePopupPanels/tests/FlexiblePopupPanels-specs.js +305 -0
  99. package/FlexiblePopupPanels/useNavButtonFocus.js +65 -0
  100. package/FormCheckboxItem/FormCheckboxItem.d.ts +87 -0
  101. package/FormCheckboxItem/FormCheckboxItem.js +200 -0
  102. package/FormCheckboxItem/FormCheckboxItem.module.css +374 -0
  103. package/FormCheckboxItem/package.json +3 -0
  104. package/FormCheckboxItem/tests/FormCheckboxItem-specs.js +164 -0
  105. package/Heading/Heading.d.ts +104 -0
  106. package/Heading/Heading.js +203 -0
  107. package/Heading/Heading.module.css +217 -0
  108. package/Heading/package.json +3 -0
  109. package/Heading/tests/Heading-specs.js +57 -0
  110. package/Icon/Icon.d.ts +377 -0
  111. package/Icon/Icon.js +503 -0
  112. package/Icon/Icon.module.css +121 -0
  113. package/Icon/IconList.js +611 -0
  114. package/Icon/package.json +3 -0
  115. package/Icon/tests/Icon-specs.js +131 -0
  116. package/IconItem/IconItem.d.ts +137 -0
  117. package/IconItem/IconItem.js +360 -0
  118. package/IconItem/IconItem.module.css +414 -0
  119. package/IconItem/package.json +3 -0
  120. package/IconItem/tests/IconItem-specs.js +106 -0
  121. package/Image/Image.d.ts +60 -0
  122. package/Image/Image.js +165 -0
  123. package/Image/Image.module.css +5 -0
  124. package/Image/package.json +3 -0
  125. package/Image/tests/Image-specs.js +62 -0
  126. package/ImageItem/ImageItem.d.ts +134 -0
  127. package/ImageItem/ImageItem.js +377 -0
  128. package/ImageItem/ImageItem.module.css +1079 -0
  129. package/ImageItem/package.json +3 -0
  130. package/ImageItem/tests/ImageItem-specs.js +223 -0
  131. package/Input/Input.js +715 -0
  132. package/Input/Input.module.css +699 -0
  133. package/Input/InputField.js +487 -0
  134. package/Input/InputField.module.css +763 -0
  135. package/Input/InputFieldDecoratorIcon.js +66 -0
  136. package/Input/InputFieldSpotlightDecorator.js +380 -0
  137. package/Input/Keypad.js +111 -0
  138. package/Input/NumberField.js +311 -0
  139. package/Input/index.d.ts +423 -0
  140. package/Input/index.js +87 -0
  141. package/Input/package.json +3 -0
  142. package/Input/pointer.js +103 -0
  143. package/Input/tests/Input-specs.js +537 -0
  144. package/Input/tests/InputField-specs.js +292 -0
  145. package/Input/tests/InputPopup-specs.js +56 -0
  146. package/Input/util.js +130 -0
  147. package/Item/Item.d.ts +108 -0
  148. package/Item/Item.js +360 -0
  149. package/Item/Item.module.css +665 -0
  150. package/Item/package.json +3 -0
  151. package/Item/tests/Item-specs.js +108 -0
  152. package/KeyGuide/KeyGuide.d.ts +103 -0
  153. package/KeyGuide/KeyGuide.js +254 -0
  154. package/KeyGuide/KeyGuide.module.css +431 -0
  155. package/KeyGuide/package.json +3 -0
  156. package/KeyGuide/tests/KeyGuide-specs.js +168 -0
  157. package/LICENSE +201 -0
  158. package/Marquee/Marquee.d.ts +42 -0
  159. package/Marquee/Marquee.js +45 -0
  160. package/Marquee/package.json +3 -0
  161. package/MediaOverlay/MediaOverlay.d.ts +134 -0
  162. package/MediaOverlay/MediaOverlay.js +304 -0
  163. package/MediaOverlay/MediaOverlay.module.css +292 -0
  164. package/MediaOverlay/package.json +3 -0
  165. package/MediaOverlay/tests/MediaOverlay-specs.js +127 -0
  166. package/MediaPlayer/MediaControls.js +934 -0
  167. package/MediaPlayer/MediaControls.module.css +86 -0
  168. package/MediaPlayer/MediaKnob.js +61 -0
  169. package/MediaPlayer/MediaSlider.js +131 -0
  170. package/MediaPlayer/MediaSlider.module.css +319 -0
  171. package/MediaPlayer/MediaSliderDecorator.js +245 -0
  172. package/MediaPlayer/Times.js +152 -0
  173. package/MediaPlayer/Times.module.css +34 -0
  174. package/MediaPlayer/index.d.ts +223 -0
  175. package/MediaPlayer/index.js +34 -0
  176. package/MediaPlayer/package.json +3 -0
  177. package/MediaPlayer/tests/MediaSlider-specs.js +126 -0
  178. package/MediaPlayer/tests/util-specs.js +114 -0
  179. package/MediaPlayer/util.js +83 -0
  180. package/PageViews/Page.js +77 -0
  181. package/PageViews/Page.module.css +3 -0
  182. package/PageViews/PageViews.js +440 -0
  183. package/PageViews/PageViews.module.css +175 -0
  184. package/PageViews/PageViewsRouter.js +150 -0
  185. package/PageViews/index.js +45 -0
  186. package/PageViews/tests/PageViews-specs.js +192 -0
  187. package/Panels/Header.js +599 -0
  188. package/Panels/Header.module.css +243 -0
  189. package/Panels/Panel.js +347 -0
  190. package/Panels/Panel.module.css +33 -0
  191. package/Panels/Panels.js +258 -0
  192. package/Panels/Panels.module.css +12 -0
  193. package/Panels/index.d.ts +376 -0
  194. package/Panels/index.js +66 -0
  195. package/Panels/package.json +3 -0
  196. package/Panels/tests/Header-specs.js +146 -0
  197. package/Panels/tests/Panels-specs.js +257 -0
  198. package/Picker/Picker.d.ts +193 -0
  199. package/Picker/Picker.js +389 -0
  200. package/Picker/Picker.module.css +46 -0
  201. package/Picker/package.json +3 -0
  202. package/Picker/tests/Picker-specs.js +91 -0
  203. package/Popup/Popup.d.ts +169 -0
  204. package/Popup/Popup.js +690 -0
  205. package/Popup/Popup.module.css +180 -0
  206. package/Popup/package.json +3 -0
  207. package/Popup/tests/Popup-specs.js +475 -0
  208. package/PopupTabLayout/PopupTabLayout.d.ts +196 -0
  209. package/PopupTabLayout/PopupTabLayout.js +605 -0
  210. package/PopupTabLayout/PopupTabLayout.module.css +226 -0
  211. package/PopupTabLayout/package.json +3 -0
  212. package/PopupTabLayout/tests/PopupTabLayout-specs.js +285 -0
  213. package/ProgressBar/ProgressBar.d.ts +171 -0
  214. package/ProgressBar/ProgressBar.js +223 -0
  215. package/ProgressBar/ProgressBar.module.css +264 -0
  216. package/ProgressBar/ProgressBarTooltip.js +359 -0
  217. package/ProgressBar/ProgressBarTooltip.module.css +86 -0
  218. package/ProgressBar/package.json +3 -0
  219. package/ProgressBar/tests/ProgressBar-specs.js +400 -0
  220. package/ProgressButton/ProgressButton.d.ts +57 -0
  221. package/ProgressButton/ProgressButton.js +143 -0
  222. package/ProgressButton/ProgressButton.module.css +147 -0
  223. package/ProgressButton/package.json +3 -0
  224. package/ProgressButton/tests/ProgressButton-specs.js +71 -0
  225. package/QuickGuidePanels/Panel.js +90 -0
  226. package/QuickGuidePanels/QuickGuidePanels.js +463 -0
  227. package/QuickGuidePanels/QuickGuidePanels.module.css +26 -0
  228. package/QuickGuidePanels/index.js +52 -0
  229. package/QuickGuidePanels/tests/QuickGuidePanels-specs.js +250 -0
  230. package/README.md +59 -0
  231. package/RadioItem/RadioItem.d.ts +59 -0
  232. package/RadioItem/RadioItem.js +146 -0
  233. package/RadioItem/RadioItem.module.css +233 -0
  234. package/RadioItem/package.json +3 -0
  235. package/RadioItem/tests/RadioItem-specs.js +62 -0
  236. package/RangePicker/RangePicker.d.ts +174 -0
  237. package/RangePicker/RangePicker.js +372 -0
  238. package/RangePicker/RangePicker.module.css +55 -0
  239. package/RangePicker/package.json +3 -0
  240. package/RangePicker/tests/RangePicker-specs.js +122 -0
  241. package/Region/Region.d.ts +33 -0
  242. package/Region/Region.js +91 -0
  243. package/Region/package.json +3 -0
  244. package/Region/tests/Region-specs.js +28 -0
  245. package/Scroller/ContentContainerDecorator.js +24 -0
  246. package/Scroller/EditableWrapper.js +1036 -0
  247. package/Scroller/EditableWrapper.module.css +22 -0
  248. package/Scroller/Scroller.d.ts +270 -0
  249. package/Scroller/Scroller.js +470 -0
  250. package/Scroller/Scroller.module.css +41 -0
  251. package/Scroller/package.json +3 -0
  252. package/Scroller/tests/ContentContainerDecorator-specs.js +20 -0
  253. package/Scroller/tests/EditableWrapper-specs.js +133 -0
  254. package/Scroller/tests/Scroller-specs.js +159 -0
  255. package/Scroller/useEvent.js +39 -0
  256. package/Scroller/useThemeScroller.js +410 -0
  257. package/Skinnable/Skinnable.d.ts +27 -0
  258. package/Skinnable/Skinnable.js +65 -0
  259. package/Skinnable/package.json +3 -0
  260. package/Slider/Slider.d.ts +218 -0
  261. package/Slider/Slider.js +441 -0
  262. package/Slider/Slider.module.css +880 -0
  263. package/Slider/SliderBehaviorDecorator.js +184 -0
  264. package/Slider/package.json +3 -0
  265. package/Slider/tests/Slider-specs.js +573 -0
  266. package/Slider/utils.js +114 -0
  267. package/Spinner/Spinner.d.ts +64 -0
  268. package/Spinner/Spinner.js +254 -0
  269. package/Spinner/Spinner.module.css +368 -0
  270. package/Spinner/package.json +3 -0
  271. package/Spinner/tests/Spinner-specs.js +70 -0
  272. package/Sprite/Sprite.d.ts +100 -0
  273. package/Sprite/Sprite.js +345 -0
  274. package/Sprite/Sprite.module.css +32 -0
  275. package/Sprite/package.json +3 -0
  276. package/Sprite/tests/Sprite-specs.js +59 -0
  277. package/Steps/Steps.d.ts +119 -0
  278. package/Steps/Steps.js +303 -0
  279. package/Steps/Steps.module.css +130 -0
  280. package/Steps/package.json +3 -0
  281. package/Steps/tests/Steps-specs.js +175 -0
  282. package/Switch/Switch.d.ts +54 -0
  283. package/Switch/Switch.js +143 -0
  284. package/Switch/Switch.module.css +714 -0
  285. package/Switch/package.json +3 -0
  286. package/Switch/tests/Switch-specs.js +54 -0
  287. package/SwitchItem/SwitchItem.d.ts +56 -0
  288. package/SwitchItem/SwitchItem.js +144 -0
  289. package/SwitchItem/SwitchItem.module.css +31 -0
  290. package/SwitchItem/package.json +3 -0
  291. package/SwitchItem/tests/SwitchItem-specs.js +49 -0
  292. package/TabLayout/RefocusDecorator.js +142 -0
  293. package/TabLayout/Tab.js +84 -0
  294. package/TabLayout/TabGroup.js +377 -0
  295. package/TabLayout/TabGroup.module.css +280 -0
  296. package/TabLayout/TabLayout.d.ts +161 -0
  297. package/TabLayout/TabLayout.js +661 -0
  298. package/TabLayout/TabLayout.module.css +101 -0
  299. package/TabLayout/package.json +3 -0
  300. package/TabLayout/tests/TabGroup-specs.js +214 -0
  301. package/TabLayout/tests/TabLayout-specs.js +740 -0
  302. package/ThemeDecorator/AccessibilityDecorator.js +151 -0
  303. package/ThemeDecorator/I18nFontDecorator.js +33 -0
  304. package/ThemeDecorator/ThemeDecorator.d.ts +143 -0
  305. package/ThemeDecorator/ThemeDecorator.js +307 -0
  306. package/ThemeDecorator/ThemeDecorator.module.css +1250 -0
  307. package/ThemeDecorator/fontGenerator.js +76 -0
  308. package/ThemeDecorator/package.json +3 -0
  309. package/ThemeDecorator/screenTypes.json +10 -0
  310. package/ThemeDecorator/tests/ThemeDecorator-specs.js +151 -0
  311. package/TimePicker/TimePicker.d.ts +147 -0
  312. package/TimePicker/TimePicker.js +255 -0
  313. package/TimePicker/TimePicker.module.css +61 -0
  314. package/TimePicker/TimePickerBase.js +396 -0
  315. package/TimePicker/package.json +3 -0
  316. package/TimePicker/tests/TimePicker-specs.js +248 -0
  317. package/TooltipDecorator/Tooltip.js +252 -0
  318. package/TooltipDecorator/Tooltip.module.css +496 -0
  319. package/TooltipDecorator/TooltipDecorator.d.ts +229 -0
  320. package/TooltipDecorator/TooltipDecorator.js +260 -0
  321. package/TooltipDecorator/TooltipLabel.js +117 -0
  322. package/TooltipDecorator/package.json +3 -0
  323. package/TooltipDecorator/tests/TooltipDecorator-specs.js +224 -0
  324. package/TooltipDecorator/tests/useTooltip-specs.js +266 -0
  325. package/TooltipDecorator/useTooltip.js +278 -0
  326. package/TooltipDecorator/util.js +273 -0
  327. package/VideoPlayer/Feedback.js +110 -0
  328. package/VideoPlayer/Feedback.module.css +55 -0
  329. package/VideoPlayer/FeedbackContent.js +99 -0
  330. package/VideoPlayer/FeedbackIcon.js +67 -0
  331. package/VideoPlayer/FeedbackIcons.js +76 -0
  332. package/VideoPlayer/FeedbackTooltip.js +242 -0
  333. package/VideoPlayer/FeedbackTooltip.module.css +160 -0
  334. package/VideoPlayer/MediaTitle.js +143 -0
  335. package/VideoPlayer/MediaTitle.module.css +95 -0
  336. package/VideoPlayer/Overlay.js +51 -0
  337. package/VideoPlayer/Video.js +345 -0
  338. package/VideoPlayer/VideoPlayer.d.ts +582 -0
  339. package/VideoPlayer/VideoPlayer.js +2116 -0
  340. package/VideoPlayer/VideoPlayer.module.css +164 -0
  341. package/VideoPlayer/package.json +3 -0
  342. package/VideoPlayer/tests/Video-specs.js +235 -0
  343. package/VideoPlayer/tests/VideoPlayer-specs.js +180 -0
  344. package/VirtualList/VirtualList.d.ts +411 -0
  345. package/VirtualList/VirtualList.js +931 -0
  346. package/VirtualList/VirtualList.module.css +52 -0
  347. package/VirtualList/package.json +3 -0
  348. package/VirtualList/tests/VirtualGridList-specs.js +289 -0
  349. package/VirtualList/tests/VirtualGridList-translate-specs.js +711 -0
  350. package/VirtualList/tests/VirtualList-specs.js +288 -0
  351. package/VirtualList/tests/VirtualList-translate-specs.js +704 -0
  352. package/VirtualList/tests/useEvent-specs.js +172 -0
  353. package/VirtualList/tests/useEvent-translate-specs.js +309 -0
  354. package/VirtualList/useEvent.js +324 -0
  355. package/VirtualList/usePreventScroll.js +31 -0
  356. package/VirtualList/useSpotlight.js +157 -0
  357. package/VirtualList/useThemeVirtualList.js +471 -0
  358. package/VirtualList/useThemeVirtualList.module.css +34 -0
  359. package/WizardPanels/Panel.js +99 -0
  360. package/WizardPanels/WizardPanels.js +501 -0
  361. package/WizardPanels/WizardPanels.module.css +15 -0
  362. package/WizardPanels/index.d.ts +182 -0
  363. package/WizardPanels/index.js +50 -0
  364. package/WizardPanels/package.json +3 -0
  365. package/WizardPanels/tests/WizardPanels-specs.js +713 -0
  366. package/codecov.yml +13 -0
  367. package/fonts/Limestone_Icons.ttf +0 -0
  368. package/fonts/Miso/LICENSE.txt +75 -0
  369. package/fonts/Miso/Miso-Bold.ttf +0 -0
  370. package/fonts/Miso/Miso-Light.ttf +0 -0
  371. package/fonts/Miso/Miso-Regular.ttf +0 -0
  372. package/fonts/MuseoSans/LICENSE.txt +75 -0
  373. package/fonts/MuseoSans/MuseoSans-Black.ttf +0 -0
  374. package/fonts/MuseoSans/MuseoSans-BlackItalic.ttf +0 -0
  375. package/fonts/MuseoSans/MuseoSans-Bold.ttf +0 -0
  376. package/fonts/MuseoSans/MuseoSans-BoldItalic.ttf +0 -0
  377. package/fonts/MuseoSans/MuseoSans-Light.ttf +0 -0
  378. package/fonts/MuseoSans/MuseoSans-Medium.ttf +0 -0
  379. package/fonts/MuseoSans/MuseoSans-MediumItalic.ttf +0 -0
  380. package/fonts/MuseoSans/MuseoSans-Thin.ttf +0 -0
  381. package/index.js +2 -0
  382. package/internal/$L/$L.d.ts +21 -0
  383. package/internal/$L/$L.js +97 -0
  384. package/internal/$L/package.json +3 -0
  385. package/internal/AsyncRenderChildren/AsyncRenderChildren.js +74 -0
  386. package/internal/AsyncRenderChildren/package.json +3 -0
  387. package/internal/AsyncRenderChildren/tests/AsyncRenderChildren-specs.js +49 -0
  388. package/internal/DateComponentPicker/DateComponentPicker.js +165 -0
  389. package/internal/DateComponentPicker/DateComponentPicker.module.css +53 -0
  390. package/internal/DateComponentPicker/DateComponentRangePicker.js +132 -0
  391. package/internal/DateComponentPicker/index.js +31 -0
  392. package/internal/DateComponentPicker/package.json +3 -0
  393. package/internal/DateTime/DateTime.js +83 -0
  394. package/internal/DateTime/DateTime.module.css +51 -0
  395. package/internal/DateTime/DateTimeDecorator.js +268 -0
  396. package/internal/DateTime/index.js +37 -0
  397. package/internal/DateTime/package.json +3 -0
  398. package/internal/DateTime/tests/DateTimeDecorator-specs.js +33 -0
  399. package/internal/DebounceDecorator/DebounceDecorator.js +125 -0
  400. package/internal/DebounceDecorator/package.json +3 -0
  401. package/internal/DebounceDecorator/tests/DebounceDecorator-specs.js +151 -0
  402. package/internal/Panels/Arrangers.js +248 -0
  403. package/internal/Panels/CancelDecorator.js +43 -0
  404. package/internal/Panels/FloatingLayerIdProvider.js +27 -0
  405. package/internal/Panels/NavigationButton.js +64 -0
  406. package/internal/Panels/NavigationButton.module.css +69 -0
  407. package/internal/Panels/PanelsRouter.js +223 -0
  408. package/internal/Panels/PopupDecorator.js +287 -0
  409. package/internal/Panels/TransitionDecorator.js +99 -0
  410. package/internal/Panels/Viewport.js +313 -0
  411. package/internal/Panels/Viewport.module.css +25 -0
  412. package/internal/Panels/captureKeys.js +48 -0
  413. package/internal/Panels/index.js +101 -0
  414. package/internal/Panels/package.json +3 -0
  415. package/internal/Panels/useAutoFocus.js +95 -0
  416. package/internal/Panels/useFocusOnTransition.js +45 -0
  417. package/internal/Panels/useToggleRole.js +30 -0
  418. package/internal/Panels/util.js +64 -0
  419. package/internal/Picker/Picker.js +942 -0
  420. package/internal/Picker/Picker.module.css +1145 -0
  421. package/internal/Picker/PickerButton.js +97 -0
  422. package/internal/Picker/PickerItem.js +38 -0
  423. package/internal/Picker/SpottablePicker.js +63 -0
  424. package/internal/Picker/package.json +3 -0
  425. package/internal/Picker/tests/Picker-specs.js +968 -0
  426. package/internal/SharedStateDecorator/SharedStateDecorator.js +167 -0
  427. package/internal/SharedStateDecorator/package.json +3 -0
  428. package/internal/SharedStateDecorator/tests/SharedStateDecorator-specs.js +277 -0
  429. package/internal/WindowEventable/WindowEventable.js +114 -0
  430. package/internal/WindowEventable/package.json +3 -0
  431. package/internal/util/package.json +3 -0
  432. package/internal/util/util.js +79 -0
  433. package/internal/validators/package.json +4 -0
  434. package/internal/validators/tests/validators-specs.js +80 -0
  435. package/internal/validators/validators.js +136 -0
  436. package/package.json +69 -0
  437. package/resources/ilibmanifest.json +3 -0
  438. package/styles/color-mixins.less +230 -0
  439. package/styles/colors-game-green.less +25 -0
  440. package/styles/colors-game-orange.less +25 -0
  441. package/styles/colors-game.less +56 -0
  442. package/styles/colors-highcontrast.less +21 -0
  443. package/styles/colors.less +435 -0
  444. package/styles/mixins.less +337 -0
  445. package/styles/skin.less +54 -0
  446. package/styles/variables-base.less +32 -0
  447. package/styles/variables-game.less +25 -0
  448. package/styles/variables.less +1182 -0
  449. package/useScroll/HoverToScroll.js +265 -0
  450. package/useScroll/HoverToScroll.module.css +38 -0
  451. package/useScroll/OverscrollEffect.module.css +14 -0
  452. package/useScroll/Scrollbar.js +171 -0
  453. package/useScroll/Scrollbar.module.css +19 -0
  454. package/useScroll/ScrollbarPlaceholder.js +64 -0
  455. package/useScroll/ScrollbarTrack.js +209 -0
  456. package/useScroll/ScrollbarTrack.module.css +136 -0
  457. package/useScroll/package.json +3 -0
  458. package/useScroll/useEvent.js +693 -0
  459. package/useScroll/useOverscrollEffect.js +105 -0
  460. package/useScroll/useScroll.js +523 -0
  461. package/useScroll/useScroll.module.css +49 -0
  462. package/useScroll/useSpotlight.js +32 -0
  463. package/useScroll/useThemeScrollContentHandle.js +32 -0
@@ -0,0 +1,2116 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Video", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _Video["default"];
10
+ }
11
+ });
12
+ exports["default"] = exports.VideoPlayerBase = exports.VideoPlayer = void 0;
13
+ var _ApiDecorator = _interopRequireDefault(require("@enact/core/internal/ApiDecorator"));
14
+ var _dispatcher = require("@enact/core/dispatcher");
15
+ var _util = require("@enact/core/util");
16
+ var _handle = require("@enact/core/handle");
17
+ var _keymap = require("@enact/core/keymap");
18
+ var _platform = require("@enact/core/platform");
19
+ var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
20
+ var _I18nDecorator = require("@enact/i18n/I18nDecorator");
21
+ var _util2 = require("@enact/i18n/util");
22
+ var _spotlight = require("@enact/spotlight");
23
+ var _SpotlightContainerDecorator = require("@enact/spotlight/SpotlightContainerDecorator");
24
+ var _Spottable = require("@enact/spotlight/Spottable");
25
+ var _Announce = _interopRequireDefault(require("@enact/ui/AnnounceDecorator/Announce"));
26
+ var _ComponentOverride = _interopRequireDefault(require("@enact/ui/ComponentOverride"));
27
+ var _FloatingLayer = require("@enact/ui/FloatingLayer");
28
+ var _FloatingLayerDecorator = require("@enact/ui/FloatingLayer/FloatingLayerDecorator");
29
+ var _Media = _interopRequireDefault(require("@enact/ui/Media"));
30
+ var _Slottable = _interopRequireDefault(require("@enact/ui/Slottable"));
31
+ var _Touchable = _interopRequireDefault(require("@enact/ui/Touchable"));
32
+ var _DurationFmt = _interopRequireDefault(require("ilib/lib/DurationFmt"));
33
+ var _propTypes2 = _interopRequireDefault(require("prop-types"));
34
+ var _react = require("react");
35
+ var _$L = _interopRequireDefault(require("../internal/$L"));
36
+ var _Button = _interopRequireDefault(require("../Button"));
37
+ var _Skinnable = _interopRequireDefault(require("../Skinnable"));
38
+ var _Spinner = _interopRequireDefault(require("../Spinner"));
39
+ var _MediaPlayer = require("../MediaPlayer");
40
+ var _Overlay = _interopRequireDefault(require("./Overlay"));
41
+ var _MediaTitle = _interopRequireDefault(require("./MediaTitle"));
42
+ var _FeedbackContent = _interopRequireDefault(require("./FeedbackContent"));
43
+ var _FeedbackTooltip = _interopRequireDefault(require("./FeedbackTooltip"));
44
+ var _Video = _interopRequireDefault(require("./Video"));
45
+ var _VideoPlayerModule = _interopRequireDefault(require("./VideoPlayer.module.css"));
46
+ var _jsxRuntime = require("react/jsx-runtime");
47
+ var _Class;
48
+ var _excluded = ["playerRef"],
49
+ _excluded2 = ["backButtonAriaLabel", "className", "disabled", "infoComponents", "initialJumpDelay", "jumpDelay", "loading", "locale", "mediaControlsComponent", "no5WayJump", "noAutoPlay", "noMiniFeedback", "noSlider", "noSpinner", "selection", "includeTimeHour", "spotlightDisabled", "spotlightId", "style", "thumbnailComponent", "thumbnailSrc", "title", "videoComponent"];
50
+ /**
51
+ * Provides Limestone-themed video player components.
52
+ *
53
+ * @module limestone/VideoPlayer
54
+ * @exports Video
55
+ * @exports VideoPlayer
56
+ * @exports VideoPlayerBase
57
+ */
58
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
59
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
60
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
61
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
62
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
63
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
64
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
65
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
66
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
67
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
68
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
69
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
70
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
71
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
72
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
73
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
74
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
75
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
76
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
77
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
78
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
79
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
80
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
81
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
82
+ var isEnter = (0, _keymap.is)('enter');
83
+ var isLeft = (0, _keymap.is)('left');
84
+ var isRight = (0, _keymap.is)('right');
85
+ var jumpBackKeyCode = 37;
86
+ var jumpForwardKeyCode = 39;
87
+ var controlsHandleAboveSelectionKeys = [13, 16777221, jumpBackKeyCode, jumpForwardKeyCode];
88
+ var getControlsHandleAboveHoldConfig = function getControlsHandleAboveHoldConfig(_ref) {
89
+ var frequency = _ref.frequency,
90
+ time = _ref.time;
91
+ return {
92
+ events: [{
93
+ name: 'hold',
94
+ time: time
95
+ }],
96
+ frequency: frequency
97
+ };
98
+ };
99
+ var shouldJump = function shouldJump(_ref2, _ref3) {
100
+ var disabled = _ref2.disabled,
101
+ no5WayJump = _ref2.no5WayJump;
102
+ var mediaControlsVisible = _ref3.mediaControlsVisible,
103
+ sourceUnavailable = _ref3.sourceUnavailable;
104
+ return !no5WayJump && !mediaControlsVisible && !(disabled || sourceUnavailable);
105
+ };
106
+ var calcNumberValueOfPlaybackRate = function calcNumberValueOfPlaybackRate(rate) {
107
+ var pbArray = String(rate).split('/');
108
+ return pbArray.length > 1 ? parseInt(pbArray[0]) / parseInt(pbArray[1]) : parseFloat(rate);
109
+ };
110
+ var RootComponent = function RootComponent(_ref4) {
111
+ var playerRef = _ref4.playerRef,
112
+ rest = _objectWithoutProperties(_ref4, _excluded);
113
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread({
114
+ ref: playerRef
115
+ }, rest));
116
+ };
117
+ RootComponent.propTypes = {
118
+ /*
119
+ * Called with the reference to the mediaControls node.
120
+ *
121
+ * @type {Object|Function}
122
+ * @public
123
+ */
124
+ playerRef: _propTypes["default"].ref
125
+ };
126
+ var SpottableDiv = (0, _Touchable["default"])((0, _Spottable.Spottable)('div'));
127
+ var RootContainer = (0, _SpotlightContainerDecorator.SpotlightContainerDecorator)({
128
+ enterTo: 'default-element',
129
+ defaultElement: [".".concat(_VideoPlayerModule["default"].controlsHandleAbove), ".".concat(_VideoPlayerModule["default"].controlsFrame)]
130
+ }, RootComponent);
131
+ var ControlsContainer = (0, _SpotlightContainerDecorator.SpotlightContainerDecorator)({
132
+ enterTo: 'default-element',
133
+ straightOnly: true
134
+ }, 'div');
135
+ var memoGetDurFmt = (0, _util.memoize)(function /* locale */
136
+ () {
137
+ return new _DurationFmt["default"]({
138
+ length: 'medium',
139
+ style: 'clock',
140
+ useNative: false
141
+ });
142
+ });
143
+ var getDurFmt = function getDurFmt(locale) {
144
+ if (typeof window === 'undefined') return null;
145
+ return memoGetDurFmt(locale);
146
+ };
147
+ var forwardWithState = function forwardWithState(type) {
148
+ return (0, _handle.adaptEvent)(function () {
149
+ return {
150
+ type: type
151
+ };
152
+ }, (0, _handle.handle)((0, _handle.adaptEvent)((0, _handle.call)('addStateToEvent'), (0, _handle.forwardWithPrevent)(type))));
153
+ };
154
+ var forwardToggleMore = (0, _handle.forward)('onToggleMore');
155
+
156
+ // provide forwarding of events on media controls
157
+ var forwardControlsAvailable = (0, _handle.forwardCustom)('onControlsAvailable');
158
+ var forwardPlay = forwardWithState('onPlay');
159
+ var forwardWillPlay = forwardWithState('onWillPlay');
160
+ var forwardPause = forwardWithState('onPause');
161
+ var forwardWillPause = forwardWithState('onWillPause');
162
+ var forwardRewind = forwardWithState('onRewind');
163
+ var forwardWillRewind = forwardWithState('onWillRewind');
164
+ var forwardFastForward = forwardWithState('onFastForward');
165
+ var forwardWillFastForward = forwardWithState('onWillFastForward');
166
+ var forwardJumpBackward = forwardWithState('onJumpBackward');
167
+ var forwardWillJumpBackward = forwardWithState('onWillJumpBackward');
168
+ var forwardJumpForward = forwardWithState('onJumpForward');
169
+ var forwardWillJumpForward = forwardWithState('onWillJumpForward');
170
+ var AnnounceState = {
171
+ // Video is loaded but additional announcements have not been made
172
+ READY: 0,
173
+ // The title should be announced
174
+ TITLE: 1,
175
+ // The title has been announced
176
+ TITLE_READ: 2,
177
+ // The infoComponents should be announced
178
+ INFO: 3,
179
+ // All announcements have been made
180
+ DONE: 4
181
+ };
182
+
183
+ /**
184
+ * Every callback sent by {@link limestone/VideoPlayer|VideoPlayer} receives a status package,
185
+ * which includes an object with the following key/value pairs as the first argument:
186
+ *
187
+ * @typedef {Object} videoStatus
188
+ * @memberof limestone/VideoPlayer
189
+ * @property {String} type - Type of event that triggered this callback
190
+ * @property {Number} currentTime - Playback index of the media in seconds
191
+ * @property {Number} duration - Media's entire duration in seconds
192
+ * @property {Boolean} paused - Playing vs paused state. `true` means the media is paused
193
+ * @property {Number} playbackRate - Current playback rate, as a number
194
+ * @property {Number} proportionLoaded - A value between `0` and `1` representing the proportion of the media that has loaded
195
+ * @property {Number} proportionPlayed - A value between `0` and `1` representing the proportion of the media that has already been shown
196
+ *
197
+ * @public
198
+ */
199
+
200
+ /**
201
+ * A set of playback rates when media fast forwards, rewinds, slow-forwards, or slow-rewinds.
202
+ *
203
+ * The number used for each operation is proportional to the normal playing speed, 1. If the rate
204
+ * is less than 1, it will play slower than normal speed, and, if it is larger than 1, it will play
205
+ * faster. If it is negative, it will play backward.
206
+ *
207
+ * The order of numbers represents the incremental order of rates that will be used for each
208
+ * operation. Note that rates can be expressed as decimals, strings, and fractions.
209
+ * (e.g.: `0.5`, `'0.5'`, `'1/2'`).
210
+ *
211
+ * @typedef {Object} playbackRateHash
212
+ * @memberof limestone/VideoPlayer
213
+ * @property {[]} fastForward - An array of playback rates when media fast forwards
214
+ * @property {[]} rewind - An array of playback rates when media rewinds
215
+ * @property {[]} slowForward - An array of playback rates when media slow-forwards
216
+ * @property {[]} slowRewind - An array of playback rates when media slow-rewinds
217
+ *
218
+ * @public
219
+ */
220
+
221
+ /**
222
+ * A player for video {@link limestone/VideoPlayer.VideoPlayerBase}.
223
+ *
224
+ * @class VideoPlayerBase
225
+ * @memberof limestone/VideoPlayer
226
+ * @ui
227
+ * @public
228
+ */
229
+ var VideoPlayerBase = exports.VideoPlayerBase = (_Class = /*#__PURE__*/function (_Component) {
230
+ function VideoPlayerBase(_props) {
231
+ var _this;
232
+ _classCallCheck(this, VideoPlayerBase);
233
+ _this = _callSuper(this, VideoPlayerBase, [_props]);
234
+
235
+ // Internal State
236
+ //
237
+ // Internal Methods
238
+ //
239
+ _this.announceJob = new _util.Job(function (msg, clear) {
240
+ return _this.announceRef && _this.announceRef.announce(msg, clear);
241
+ }, 200);
242
+ _this.announce = function (msg, clear) {
243
+ _this.announceJob.start(msg, clear);
244
+ };
245
+ _this.activityDetected = function () {
246
+ _this.startAutoCloseTimeout();
247
+ };
248
+ _this.startAutoCloseTimeout = function () {
249
+ // If this.state.more is used as a reference for when this function should fire, timing for
250
+ // detection of when "more" is pressed vs when the state is updated is mismatched. Using an
251
+ // instance variable that's only set and used for this express purpose seems cleanest.
252
+ if (_this.props.autoCloseTimeout && _this.state.mediaControlsVisible) {
253
+ _this.autoCloseJob.startAfter(_this.props.autoCloseTimeout);
254
+ }
255
+ };
256
+ _this.stopAutoCloseTimeout = function () {
257
+ _this.autoCloseJob.stop();
258
+ };
259
+ _this.generateId = function () {
260
+ return Math.random().toString(36).substring(2, 10);
261
+ };
262
+ /**
263
+ * If the announce state is either ready to read the title or ready to read info, advance the
264
+ * state to "read".
265
+ *
266
+ * @returns {Boolean} Returns true to be used in event handlers
267
+ * @private
268
+ */
269
+ _this.markAnnounceRead = function () {
270
+ if (_this.state.announce === AnnounceState.TITLE) {
271
+ _this.setState({
272
+ announce: AnnounceState.TITLE_READ
273
+ });
274
+ } else if (_this.state.announce === AnnounceState.INFO) {
275
+ _this.setState({
276
+ announce: AnnounceState.DONE
277
+ });
278
+ }
279
+ return true;
280
+ };
281
+ /**
282
+ * Shows media controls.
283
+ *
284
+ * @function
285
+ * @memberof limestone/VideoPlayer.VideoPlayerBase.prototype
286
+ * @public
287
+ */
288
+ _this.showControls = function () {
289
+ if (_this.props.disabled) {
290
+ return;
291
+ }
292
+ _this.startDelayedFeedbackHide();
293
+ _this.startDelayedTitleHide();
294
+ _this.setState(function (_ref5) {
295
+ var announce = _ref5.announce;
296
+ if (announce === AnnounceState.READY) {
297
+ // if we haven't read the title yet, do so this time
298
+ announce = AnnounceState.TITLE;
299
+ } else if (announce === AnnounceState.TITLE) {
300
+ // if we have read the title, advance to INFO so title isn't read again
301
+ announce = AnnounceState.TITLE_READ;
302
+ }
303
+ return {
304
+ announce: announce,
305
+ bottomControlsRendered: true,
306
+ feedbackAction: 'idle',
307
+ feedbackVisible: true,
308
+ mediaControlsVisible: true,
309
+ mediaSliderVisible: true,
310
+ miniFeedbackVisible: false,
311
+ titleVisible: true
312
+ };
313
+ });
314
+ };
315
+ /**
316
+ * Hides media controls.
317
+ *
318
+ * @function
319
+ * @memberof limestone/VideoPlayer.VideoPlayerBase.prototype
320
+ * @public
321
+ */
322
+ _this.hideControls = function () {
323
+ _this.stopDelayedFeedbackHide();
324
+ _this.stopDelayedMiniFeedbackHide();
325
+ _this.stopDelayedTitleHide();
326
+ _this.stopAutoCloseTimeout();
327
+ _this.setState({
328
+ feedbackAction: 'idle',
329
+ feedbackVisible: false,
330
+ mediaControlsVisible: false,
331
+ mediaSliderVisible: false,
332
+ miniFeedbackVisible: false,
333
+ infoVisible: false
334
+ });
335
+ _this.markAnnounceRead();
336
+ };
337
+ /**
338
+ * Toggles the media controls.
339
+ *
340
+ * @function
341
+ * @memberof limestone/VideoPlayer.VideoPlayerBase.prototype
342
+ * @public
343
+ */
344
+ _this.toggleControls = function () {
345
+ if (_this.state.mediaControlsVisible) {
346
+ _this.hideControls();
347
+ } else {
348
+ _this.showControls();
349
+ }
350
+ };
351
+ _this.doAutoClose = function () {
352
+ _this.stopDelayedFeedbackHide();
353
+ _this.stopDelayedTitleHide();
354
+ _this.setState(function (_ref6) {
355
+ var mediaSliderVisible = _ref6.mediaSliderVisible,
356
+ miniFeedbackVisible = _ref6.miniFeedbackVisible;
357
+ return {
358
+ feedbackVisible: false,
359
+ mediaControlsVisible: false,
360
+ mediaSliderVisible: mediaSliderVisible && miniFeedbackVisible,
361
+ infoVisible: false
362
+ };
363
+ });
364
+ _this.markAnnounceRead();
365
+ };
366
+ _this.autoCloseJob = new _util.Job(_this.doAutoClose);
367
+ _this.startDelayedTitleHide = function () {
368
+ if (_this.props.titleHideDelay) {
369
+ _this.hideTitleJob.startAfter(_this.props.titleHideDelay);
370
+ }
371
+ };
372
+ _this.stopDelayedTitleHide = function () {
373
+ _this.hideTitleJob.stop();
374
+ };
375
+ _this.hideTitle = function () {
376
+ _this.setState({
377
+ titleVisible: false
378
+ });
379
+ };
380
+ _this.hideTitleJob = new _util.Job(_this.hideTitle);
381
+ _this.startDelayedFeedbackHide = function () {
382
+ if (_this.props.feedbackHideDelay) {
383
+ _this.hideFeedbackJob.startAfter(_this.props.feedbackHideDelay);
384
+ }
385
+ };
386
+ _this.stopDelayedFeedbackHide = function () {
387
+ _this.hideFeedbackJob.stop();
388
+ };
389
+ _this.showFeedback = function () {
390
+ if (_this.state.mediaControlsVisible) {
391
+ _this.setState({
392
+ feedbackVisible: true
393
+ });
394
+ } else {
395
+ var shouldShowSlider = _this.pulsedPlaybackState !== null || calcNumberValueOfPlaybackRate(_this.playbackRate) !== 1;
396
+ if (_this.showMiniFeedback && (!_this.state.miniFeedbackVisible || _this.state.mediaSliderVisible !== shouldShowSlider)) {
397
+ _this.setState(function (_ref7) {
398
+ var loading = _ref7.loading,
399
+ duration = _ref7.duration,
400
+ error = _ref7.error;
401
+ return {
402
+ mediaSliderVisible: shouldShowSlider && !_this.props.noMediaSliderFeedback,
403
+ miniFeedbackVisible: !(loading || !duration || error)
404
+ };
405
+ });
406
+ }
407
+ }
408
+ };
409
+ _this.hideFeedback = function () {
410
+ if (_this.state.feedbackVisible && _this.state.feedbackAction !== 'focus') {
411
+ _this.setState({
412
+ feedbackVisible: false,
413
+ feedbackAction: 'idle'
414
+ });
415
+ }
416
+ };
417
+ _this.hideFeedbackJob = new _util.Job(_this.hideFeedback);
418
+ _this.startDelayedMiniFeedbackHide = function () {
419
+ var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.miniFeedbackHideDelay;
420
+ if (delay) {
421
+ _this.hideMiniFeedbackJob.startAfter(delay);
422
+ }
423
+ };
424
+ _this.stopDelayedMiniFeedbackHide = function () {
425
+ _this.hideMiniFeedbackJob.stop();
426
+ };
427
+ _this.hideMiniFeedback = function () {
428
+ if (_this.state.miniFeedbackVisible) {
429
+ _this.showMiniFeedback = false;
430
+ _this.setState({
431
+ mediaSliderVisible: false,
432
+ miniFeedbackVisible: false
433
+ });
434
+ }
435
+ };
436
+ _this.hideMiniFeedbackJob = new _util.Job(_this.hideMiniFeedback);
437
+ _this.handle = _handle.handle.bind(_this);
438
+ _this.showControlsFromPointer = function () {
439
+ _spotlight.Spotlight.setPointerMode(false);
440
+ _this.showControls();
441
+ };
442
+ _this.clearPulsedPlayback = function () {
443
+ _this.pulsedPlaybackRate = null;
444
+ _this.pulsedPlaybackState = null;
445
+ };
446
+ // only show mini feedback if playback controls are invoked by a key event
447
+ _this.shouldShowMiniFeedback = function (ev) {
448
+ if (ev.type === 'keyup') {
449
+ _this.showMiniFeedback = true;
450
+ }
451
+ return true;
452
+ };
453
+ _this.handleLoadStart = function () {
454
+ _this.firstPlayReadFlag = true;
455
+ _this.prevCommand = _this.props.noAutoPlay ? 'pause' : 'play';
456
+ _this.speedIndex = 0;
457
+ _this.setState({
458
+ announce: AnnounceState.READY,
459
+ currentTime: 0,
460
+ sourceUnavailable: true,
461
+ proportionPlayed: 0,
462
+ proportionLoaded: 0
463
+ });
464
+ if (!_this.props.noAutoShowMediaControls) {
465
+ if (!_this.state.bottomControlsRendered) {
466
+ _this.renderBottomControl.idle();
467
+ } else {
468
+ _this.showControls();
469
+ }
470
+ }
471
+ };
472
+ _this.handlePlay = _this.handle(forwardWillPlay, _this.shouldShowMiniFeedback, function () {
473
+ return _this.play();
474
+ }, forwardPlay);
475
+ _this.handlePause = _this.handle(forwardWillPause, _this.shouldShowMiniFeedback, function () {
476
+ return _this.pause();
477
+ }, forwardPause);
478
+ _this.handleRewind = _this.handle(forwardWillRewind, _this.shouldShowMiniFeedback, function () {
479
+ return _this.rewind();
480
+ }, forwardRewind);
481
+ _this.handleFastForward = _this.handle(forwardWillFastForward, _this.shouldShowMiniFeedback, function () {
482
+ return _this.fastForward();
483
+ }, forwardFastForward);
484
+ _this.handleJump = function (_ref8) {
485
+ var keyCode = _ref8.keyCode;
486
+ if (_this.props.seekDisabled) {
487
+ (0, _handle.forwardCustom)('onSeekFailed')(null, _this.props);
488
+ } else {
489
+ var jumpBy = ((0, _keymap.is)('left', keyCode) ? -1 : 1) * _this.props.jumpBy;
490
+ var time = Math.min(_this.state.duration, Math.max(0, _this.state.currentTime + jumpBy));
491
+ if (_this.preventTimeChange(time)) return;
492
+ _this.showMiniFeedback = true;
493
+ _this.jump(jumpBy);
494
+ _this.announceJob.startAfter(500, (0, _MediaPlayer.secondsToTime)(_this.video.currentTime, getDurFmt(_this.props.locale), {
495
+ includeHour: true
496
+ }));
497
+ }
498
+ };
499
+ _this.handleGlobalKeyDown = _this.handle((0, _handle.returnsTrue)(_this.activityDetected), (0, _handle.forKey)('down'), function () {
500
+ return !_this.state.mediaControlsVisible && (!_spotlight.Spotlight.getCurrent() && _spotlight.Spotlight.getPointerMode() || !_spotlight.Spotlight.getPointerMode()) && !_this.props.spotlightDisabled;
501
+ }, _handle.preventDefault, _handle.stopImmediate, _this.showControlsFromPointer);
502
+ _this.handleControlsHandleAboveHold = function () {
503
+ if (shouldJump(_this.props, _this.state)) {
504
+ _this.handleJump({
505
+ keyCode: _this.jumpButtonPressed === -1 ? jumpBackKeyCode : jumpForwardKeyCode
506
+ });
507
+ }
508
+ };
509
+ _this.handleControlsHandleAboveKeyDown = function (_ref9) {
510
+ var keyCode = _ref9.keyCode;
511
+ if (isEnter(keyCode)) {
512
+ _this.jumpButtonPressed = 0;
513
+ } else if (isLeft(keyCode)) {
514
+ _this.jumpButtonPressed = -1;
515
+ } else if (isRight(keyCode)) {
516
+ _this.jumpButtonPressed = 1;
517
+ }
518
+ };
519
+ _this.handleControlsHandleAboveKeyUp = function (_ref0) {
520
+ var keyCode = _ref0.keyCode;
521
+ if (isEnter(keyCode) || isLeft(keyCode) || isRight(keyCode)) {
522
+ _this.jumpButtonPressed = null;
523
+ }
524
+ };
525
+ _this.handleControlsHandleAboveDown = function () {
526
+ if (_this.jumpButtonPressed === 0) {
527
+ _this.showControls();
528
+ } else if (_this.jumpButtonPressed === -1 || _this.jumpButtonPressed === 1) {
529
+ var keyCode = _this.jumpButtonPressed === -1 ? jumpBackKeyCode : jumpForwardKeyCode;
530
+ if (shouldJump(_this.props, _this.state)) {
531
+ _this.handleJump({
532
+ keyCode: keyCode
533
+ });
534
+ } else {
535
+ _spotlight.Spotlight.move((0, _spotlight.getDirection)(keyCode));
536
+ }
537
+ }
538
+ };
539
+ //
540
+ // Media Interaction Methods
541
+ //
542
+ _this.handleEvent = function () {
543
+ var el = _this.video;
544
+ var updatedState = {
545
+ // Standard media properties
546
+ currentTime: el.currentTime,
547
+ duration: el.duration,
548
+ paused: _this.state.seekingMode ? el.playbackRate !== 1 || el.paused : el.paused,
549
+ playbackRate: el.playbackRate,
550
+ // Non-standard state computed from properties
551
+ error: el.error,
552
+ loading: el.loading,
553
+ proportionLoaded: el.proportionLoaded,
554
+ proportionPlayed: el.proportionPlayed || 0,
555
+ sliderTooltipTime: el.currentTime,
556
+ // note: `el.loading && this.state.sourceUnavailable == false` is equivalent to `oncanplaythrough`
557
+ sourceUnavailable: el.loading && _this.state.sourceUnavailable || el.error
558
+ };
559
+
560
+ // If there's an error, we're obviously not loading, no matter what the readyState is.
561
+ if (updatedState.error) updatedState.loading = false;
562
+ var isRewind = _this.prevCommand === 'rewind' || _this.prevCommand === 'slowRewind';
563
+ var isForward = _this.prevCommand === 'fastForward' || _this.prevCommand === 'slowForward';
564
+ if (_this.props.pauseAtEnd && (el.currentTime === 0 && isRewind || el.currentTime === el.duration && isForward)) {
565
+ _this.pause();
566
+ }
567
+ _this.setState(updatedState);
568
+ };
569
+ _this.renderBottomControl = new _util.Job(function () {
570
+ if (!_this.state.bottomControlsRendered) {
571
+ _this.setState({
572
+ bottomControlsRendered: true
573
+ });
574
+ }
575
+ });
576
+ /**
577
+ * Returns an object with the current state of the media including `currentTime`, `duration`,
578
+ * `paused`, `playbackRate`, `proportionLoaded`, and `proportionPlayed`.
579
+ *
580
+ * @function
581
+ * @memberof limestone/VideoPlayer.VideoPlayerBase.prototype
582
+ * @returns {Object}
583
+ * @public
584
+ */
585
+ _this.getMediaState = function () {
586
+ return {
587
+ currentTime: _this.video.currentTime,
588
+ duration: _this.state.duration,
589
+ paused: _this.state.seekingMode ? _this.video.playbackRate !== 1 || _this.video.paused : _this.video.paused,
590
+ playbackRate: _this.video.playbackRate,
591
+ proportionLoaded: _this.video.proportionLoaded,
592
+ proportionPlayed: _this.video.proportionPlayed || 0
593
+ };
594
+ };
595
+ /**
596
+ * The primary means of interacting with the `<video>` element.
597
+ *
598
+ * @param {String} action The method to preform.
599
+ * @param {Multiple} props The arguments, in the format that the action method requires.
600
+ *
601
+ * @private
602
+ */
603
+ _this.send = function (action, props) {
604
+ _this.clearPulsedPlayback();
605
+ _this.showFeedback();
606
+ _this.startDelayedFeedbackHide();
607
+ _this.video[action](props);
608
+ };
609
+ /**
610
+ * Programmatically plays the current media.
611
+ * If you call this function during fast forwarding or rewinding, the playback speed will be set to normal.
612
+ *
613
+ * @function
614
+ * @memberof limestone/VideoPlayer.VideoPlayerBase.prototype
615
+ * @public
616
+ */
617
+ _this.play = function () {
618
+ if (_this.state.sourceUnavailable) {
619
+ return false;
620
+ }
621
+ if (_this.state.seekingMode) {
622
+ _this.setPlaybackRate(1);
623
+ }
624
+ _this.speedIndex = 0;
625
+ // must happen before send() to ensure feedback uses the right value
626
+ // TODO: refactor into this.state member
627
+ _this.prevCommand = 'play';
628
+ _this.send('play');
629
+ _this.announce((0, _$L["default"])('Play'));
630
+ _this.startDelayedMiniFeedbackHide(5000);
631
+ return true;
632
+ };
633
+ /**
634
+ * Programmatically pauses the current media.
635
+ * If you call this function during fast forwarding or rewinding, the playback speed will be set to normal.
636
+ *
637
+ * @function
638
+ * @memberof limestone/VideoPlayer.VideoPlayerBase.prototype
639
+ * @public
640
+ */
641
+ _this.pause = function () {
642
+ if (_this.state.sourceUnavailable) {
643
+ return false;
644
+ }
645
+ if (_this.state.seekingMode) {
646
+ _this.setPlaybackRate(1);
647
+ }
648
+ _this.speedIndex = 0;
649
+ // must happen before send() to ensure feedback uses the right value
650
+ // TODO: refactor into this.state member
651
+ _this.prevCommand = 'pause';
652
+ _this.send('pause');
653
+ _this.announce((0, _$L["default"])('Pause'));
654
+ _this.stopDelayedMiniFeedbackHide();
655
+ return true;
656
+ };
657
+ /**
658
+ * Sets the media playback time index.
659
+ *
660
+ * @function
661
+ * @memberof limestone/VideoPlayer.VideoPlayerBase.prototype
662
+ * @param {Number} timeIndex - Time index to seek
663
+ * @public
664
+ */
665
+ _this.seek = function (timeIndex) {
666
+ if (!_this.props.seekDisabled && !isNaN(_this.video.duration) && !_this.state.sourceUnavailable) {
667
+ _this.video.currentTime = timeIndex;
668
+ } else {
669
+ (0, _handle.forwardCustom)('onSeekFailed')(null, _this.props);
670
+ }
671
+ };
672
+ /**
673
+ * Step a given amount of time away from the current playback position.
674
+ * Like {@link limestone/VideoPlayer.VideoPlayerBase.seek|seek} but relative.
675
+ *
676
+ * @function
677
+ * @memberof limestone/VideoPlayer.VideoPlayerBase.prototype
678
+ * @param {Number} distance - Time value to jump
679
+ * @public
680
+ */
681
+ _this.jump = function (distance) {
682
+ if (_this.state.sourceUnavailable) {
683
+ return false;
684
+ }
685
+ _this.pulsedPlaybackRate = (0, _util2.toUpperCase)(new _DurationFmt["default"]({
686
+ length: 'long'
687
+ }).format({
688
+ second: _this.props.jumpBy
689
+ }));
690
+ _this.pulsedPlaybackState = distance > 0 ? 'jumpForward' : 'jumpBackward';
691
+ _this.showFeedback();
692
+ _this.startDelayedFeedbackHide();
693
+ _this.seek(_this.state.currentTime + distance);
694
+ _this.startDelayedMiniFeedbackHide();
695
+ return true;
696
+ };
697
+ /**
698
+ * Fast forwards the current media for seeking.
699
+ * This function changes the playback rate.
700
+ * If you call `play` or `pause` during fast forwarding, the playback speed will be set to normal.
701
+ *
702
+ * @function
703
+ * @memberof limestone/VideoPlayer.VideoPlayerBase.prototype
704
+ * @public
705
+ */
706
+ _this.fastForward = function () {
707
+ if (_this.state.sourceUnavailable) {
708
+ return false;
709
+ }
710
+ _this.setState({
711
+ seekingMode: true
712
+ });
713
+ var shouldResumePlayback = false;
714
+ switch (_this.prevCommand) {
715
+ case 'slowForward':
716
+ if (_this.speedIndex === _this.playbackRates.length - 1) {
717
+ // reached to the end of array => fastforward
718
+ _this.selectPlaybackRates('fastForward');
719
+ _this.speedIndex = 0;
720
+ _this.prevCommand = 'fastForward';
721
+ } else {
722
+ _this.speedIndex = _this.clampPlaybackRate(_this.speedIndex + 1);
723
+ }
724
+ break;
725
+ case 'pause':
726
+ _this.selectPlaybackRates('slowForward');
727
+ if (_this.state.paused) {
728
+ shouldResumePlayback = true;
729
+ }
730
+ _this.speedIndex = 0;
731
+ _this.prevCommand = 'slowForward';
732
+ break;
733
+ case 'fastForward':
734
+ _this.speedIndex = _this.clampPlaybackRate(_this.speedIndex + 1);
735
+ _this.prevCommand = 'fastForward';
736
+ break;
737
+ default:
738
+ _this.selectPlaybackRates('fastForward');
739
+ _this.speedIndex = 0;
740
+ _this.prevCommand = 'fastForward';
741
+ if (_this.state.paused) {
742
+ shouldResumePlayback = true;
743
+ }
744
+ break;
745
+ }
746
+ _this.setPlaybackRate(_this.selectPlaybackRate(_this.speedIndex));
747
+ if (shouldResumePlayback) _this.send('play');
748
+ _this.stopDelayedFeedbackHide();
749
+ _this.stopDelayedMiniFeedbackHide();
750
+ _this.clearPulsedPlayback();
751
+ _this.showFeedback();
752
+ return true;
753
+ };
754
+ /**
755
+ * Rewinds the current media for seeking.
756
+ * This function changes the playback rate.
757
+ * If you call `play` or `pause` during rewinding, the playback speed will be set to normal.
758
+ *
759
+ * @function
760
+ * @memberof limestone/VideoPlayer.VideoPlayerBase.prototype
761
+ * @public
762
+ */
763
+ _this.rewind = function () {
764
+ if (_this.state.sourceUnavailable) {
765
+ return false;
766
+ }
767
+ _this.setState({
768
+ seekingMode: true
769
+ });
770
+ var rateForSlowRewind = _this.props.playbackRateHash['slowRewind'];
771
+ var shouldResumePlayback = false,
772
+ command = 'rewind';
773
+ if (_this.video.currentTime === 0) {
774
+ // Do not rewind if currentTime is 0. We're already at the beginning.
775
+ return true;
776
+ }
777
+ switch (_this.prevCommand) {
778
+ case 'slowRewind':
779
+ if (_this.speedIndex === _this.playbackRates.length - 1) {
780
+ // reached to the end of array => go to rewind
781
+ _this.selectPlaybackRates(command);
782
+ _this.speedIndex = 0;
783
+ _this.prevCommand = command;
784
+ } else {
785
+ _this.speedIndex = _this.clampPlaybackRate(_this.speedIndex + 1);
786
+ }
787
+ break;
788
+ case 'pause':
789
+ // If it's possible to slowRewind, do it, otherwise just leave it as normal rewind : QEVENTSEVT-17386
790
+ if (rateForSlowRewind && rateForSlowRewind.length >= 0) {
791
+ command = 'slowRewind';
792
+ }
793
+ _this.selectPlaybackRates(command);
794
+ if (_this.state.paused && _this.state.duration > _this.state.currentTime) {
795
+ shouldResumePlayback = true;
796
+ }
797
+ _this.speedIndex = 0;
798
+ _this.prevCommand = command;
799
+ break;
800
+ case 'rewind':
801
+ _this.speedIndex = _this.clampPlaybackRate(_this.speedIndex + 1);
802
+ _this.prevCommand = command;
803
+ break;
804
+ default:
805
+ _this.selectPlaybackRates(command);
806
+ _this.speedIndex = 0;
807
+ _this.prevCommand = command;
808
+ break;
809
+ }
810
+ _this.setPlaybackRate(_this.selectPlaybackRate(_this.speedIndex));
811
+ if (shouldResumePlayback) _this.send('play');
812
+ _this.stopDelayedFeedbackHide();
813
+ _this.stopDelayedMiniFeedbackHide();
814
+ _this.clearPulsedPlayback();
815
+ _this.showFeedback();
816
+ return true;
817
+ };
818
+ /**
819
+ * Sets the playback speed.
820
+ *
821
+ * @function
822
+ * @memberof limestone/VideoPlayer.VideoPlayerBase.prototype
823
+ * @param {Number} rate - The desired playback rate. This value is passed to the `playbackRate` property of `HTMLMediaElement`.
824
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/playbackRate|MDN playbackRate property}
825
+ * @returns {Boolean} Returns true if the speed changes successfully.
826
+ * @public
827
+ */
828
+ _this.setPlaybackSpeed = function (rate) {
829
+ if (_this.state.sourceUnavailable) {
830
+ return false;
831
+ }
832
+ _this.setState({
833
+ seekingMode: false
834
+ });
835
+ _this.setPlaybackRate(rate);
836
+ return true;
837
+ };
838
+ // Creates a proxy to the video node if Proxy is supported
839
+ _this.videoProxy = typeof Proxy !== 'function' ? null : new Proxy({}, {
840
+ get: function get(target, name) {
841
+ var value = _this.video[name];
842
+ if (typeof value === 'function') {
843
+ value = value.bind(_this.video);
844
+ }
845
+ return value;
846
+ },
847
+ set: function set(target, name, value) {
848
+ return _this.video[name] = value;
849
+ }
850
+ });
851
+ /**
852
+ * Returns a proxy to the underlying `<video>` node currently used by the VideoPlayer
853
+ *
854
+ * @function
855
+ * @memberof limestone/VideoPlayer.VideoPlayerBase.prototype
856
+ * @public
857
+ */
858
+ _this.getVideoNode = function () {
859
+ return _this.videoProxy || _this.video;
860
+ };
861
+ _this.areControlsVisible = function () {
862
+ return _this.state.mediaControlsVisible;
863
+ };
864
+ /**
865
+ * Sets the playback rate type for video seeking (from the keys of {@link limestone/VideoPlayer.VideoPlayer.playbackRateHash|playbackRateHash}).
866
+ *
867
+ * @param {String} cmd - Key of the playback rate type.
868
+ * @private
869
+ */
870
+ _this.selectPlaybackRates = function (cmd) {
871
+ _this.playbackRates = _this.props.playbackRateHash[cmd];
872
+ };
873
+ /**
874
+ * Changes playbackRate to a valid value when initiating fast-forward or rewind.
875
+ *
876
+ * @param {Number} idx - The index of the desired playback rate.
877
+ * @private
878
+ */
879
+ _this.clampPlaybackRate = function (idx) {
880
+ if (!_this.playbackRates) {
881
+ return;
882
+ }
883
+ return idx % _this.playbackRates.length;
884
+ };
885
+ /**
886
+ * Retrieves the playback rate value.
887
+ *
888
+ * @param {Number} idx - The index of the desired playback rate.
889
+ * @returns {Number|String} The playback rate value.
890
+ * @private
891
+ */
892
+ _this.selectPlaybackRate = function (idx) {
893
+ return _this.playbackRates[idx];
894
+ };
895
+ /**
896
+ * Sets playbackRate.
897
+ *
898
+ * @param {Number|String} rate - The desired playback rate.
899
+ * @private
900
+ */
901
+ _this.setPlaybackRate = function (rate) {
902
+ if (_this.state.seekingMode) {
903
+ // Stop rewind (if happening)
904
+ _this.stopRewindJob();
905
+ }
906
+
907
+ // Make sure rate is a string
908
+ _this.playbackRate = String(rate);
909
+ var pbNumber = calcNumberValueOfPlaybackRate(_this.playbackRate);
910
+ if (_platform.platform.type !== 'webos') {
911
+ // ReactDOM throws error for setting negative value for playbackRate
912
+ _this.video.playbackRate = pbNumber < 0 ? 0 : pbNumber;
913
+ if (_this.state.seekingMode) {
914
+ // For supporting cross browser behavior
915
+ if (pbNumber < 0) {
916
+ _this.beginRewind();
917
+ }
918
+ }
919
+ } else {
920
+ // Set native playback rate
921
+ _this.video.playbackRate = pbNumber;
922
+ }
923
+ };
924
+ /**
925
+ * Calculates the time that has elapsed since. This is necessary for browsers until negative
926
+ * playback rate is directly supported.
927
+ *
928
+ * @private
929
+ */
930
+ _this.rewindManually = function () {
931
+ var now = (0, _util.perfNow)(),
932
+ distance = now - _this.rewindBeginTime,
933
+ pbRate = calcNumberValueOfPlaybackRate(_this.playbackRate),
934
+ adjustedDistance = distance * pbRate / 1000;
935
+ _this.jump(adjustedDistance);
936
+ _this.stopDelayedMiniFeedbackHide();
937
+ _this.clearPulsedPlayback();
938
+ _this.startRewindJob(); // Issue another rewind tick
939
+ };
940
+ _this.rewindJob = new _util.Job(_this.rewindManually, 100);
941
+ /**
942
+ * Starts rewind job.
943
+ *
944
+ * @private
945
+ */
946
+ _this.startRewindJob = function () {
947
+ _this.rewindBeginTime = (0, _util.perfNow)();
948
+ _this.rewindJob.start();
949
+ };
950
+ /**
951
+ * Stops rewind job.
952
+ *
953
+ * @private
954
+ */
955
+ _this.stopRewindJob = function () {
956
+ _this.rewindJob.stop();
957
+ };
958
+ /**
959
+ * Implements custom rewind functionality (until browsers support negative playback rate).
960
+ *
961
+ * @private
962
+ */
963
+ _this.beginRewind = function () {
964
+ _this.send('pause');
965
+ _this.startRewindJob();
966
+ };
967
+ //
968
+ // Handled Media events
969
+ //
970
+ _this.addStateToEvent = function (ev) {
971
+ return _objectSpread({
972
+ // More props from `ev` may be added here as needed, but a full copy via `...ev`
973
+ // overloads Storybook's Action Logger and likely has other perf fallout.
974
+ type: ev.type
975
+ }, _this.getMediaState());
976
+ };
977
+ //
978
+ // Player Interaction events
979
+ //
980
+ _this.onVideoClick = function () {
981
+ _this.toggleControls();
982
+ };
983
+ _this.onSliderChange = function (_ref1) {
984
+ var value = _ref1.value;
985
+ var time = value * _this.state.duration;
986
+ if (_this.preventTimeChange(time)) return;
987
+ _this.seek(time);
988
+ _this.sliderScrubbing = false;
989
+ };
990
+ _this.handleBack = _this.handle((0, _handle.forwardCustom)('onBack'));
991
+ _this.handleKnobMove = function (ev) {
992
+ _this.sliderScrubbing = true;
993
+
994
+ // prevent announcing repeatedly when the knob is detached from the progress.
995
+ // TODO: fix Slider to not send onKnobMove when the knob hasn't, in fact, moved
996
+ if (_this.sliderKnobProportion !== ev.proportion) {
997
+ _this.sliderKnobProportion = ev.proportion;
998
+ var seconds = Math.floor(_this.sliderKnobProportion * _this.video.duration);
999
+ if (!isNaN(seconds)) {
1000
+ var knobTime = (0, _MediaPlayer.secondsToTime)(seconds, getDurFmt(_this.props.locale), {
1001
+ includeHour: true
1002
+ });
1003
+ (0, _handle.forward)('onScrub', _objectSpread(_objectSpread({}, ev), {}, {
1004
+ seconds: seconds,
1005
+ type: 'onScrub'
1006
+ }), _this.props);
1007
+ _this.announce("".concat((0, _$L["default"])('jump to'), " ").concat(knobTime), true);
1008
+ }
1009
+ }
1010
+ };
1011
+ _this.handleSliderFocus = function () {
1012
+ var seconds = Math.floor(_this.sliderKnobProportion * _this.video.duration);
1013
+ _this.sliderScrubbing = true;
1014
+ _this.setState({
1015
+ feedbackAction: 'focus',
1016
+ feedbackVisible: true
1017
+ });
1018
+ _this.stopDelayedFeedbackHide();
1019
+ if (!isNaN(seconds)) {
1020
+ var knobTime = (0, _MediaPlayer.secondsToTime)(seconds, getDurFmt(_this.props.locale), {
1021
+ includeHour: true
1022
+ });
1023
+ (0, _handle.forward)('onScrub', {
1024
+ detached: _this.sliderScrubbing,
1025
+ proportion: _this.sliderKnobProportion,
1026
+ seconds: seconds,
1027
+ type: 'onScrub'
1028
+ }, _this.props);
1029
+ _this.announce("".concat((0, _$L["default"])('jump to'), " ").concat(knobTime), true);
1030
+ }
1031
+ };
1032
+ _this.handleSliderBlur = function () {
1033
+ _this.sliderScrubbing = false;
1034
+ _this.startDelayedFeedbackHide();
1035
+ _this.setState(function () {
1036
+ return {
1037
+ feedbackAction: 'blur',
1038
+ feedbackVisible: true
1039
+ };
1040
+ });
1041
+ };
1042
+ _this.slider5WayPressJob = new _util.Job(function () {
1043
+ _this.setState({
1044
+ slider5WayPressed: false
1045
+ });
1046
+ }, 200);
1047
+ _this.handleSliderKeyDown = function (ev) {
1048
+ var keyCode = ev.keyCode;
1049
+ if ((0, _keymap.is)('enter', keyCode)) {
1050
+ _this.setState({
1051
+ slider5WayPressed: true
1052
+ }, _this.slider5WayPressJob.start());
1053
+ } else if ((0, _keymap.is)('down', keyCode)) {
1054
+ _spotlight.Spotlight.setPointerMode(false);
1055
+ if (_spotlight.Spotlight.focus(_this.mediaControlsSpotlightId)) {
1056
+ (0, _handle.preventDefault)(ev);
1057
+ (0, _handle.stopImmediate)(ev);
1058
+ }
1059
+ } else if ((0, _keymap.is)('up', keyCode)) {
1060
+ _spotlight.Spotlight.setPointerMode(false);
1061
+ }
1062
+ };
1063
+ _this.onJumpBackward = _this.handle(forwardWillJumpBackward, function () {
1064
+ return _this.jump(-1 * _this.props.jumpBy);
1065
+ }, forwardJumpBackward);
1066
+ _this.onJumpForward = _this.handle(forwardWillJumpForward, function () {
1067
+ return _this.jump(_this.props.jumpBy);
1068
+ }, forwardJumpForward);
1069
+ _this.handleToggleMore = function (ev) {
1070
+ var showMoreComponents = ev.showMoreComponents,
1071
+ liftDistance = ev.liftDistance;
1072
+ forwardToggleMore(ev, _this.props);
1073
+ if (!showMoreComponents) {
1074
+ _this.startAutoCloseTimeout(); // Restore the timer since we are leaving "more".
1075
+ // Restore the title-hide now that we're finished with "more".
1076
+ _this.startDelayedTitleHide();
1077
+ } else {
1078
+ // Interrupt the title-hide since we don't want it hiding autonomously in "more".
1079
+ _this.stopDelayedTitleHide();
1080
+ }
1081
+ _this.playerRef.current.style.setProperty('--liftDistance', "".concat(liftDistance, "px"));
1082
+ _this.setState(function (_ref10) {
1083
+ var announce = _ref10.announce;
1084
+ return {
1085
+ infoVisible: showMoreComponents,
1086
+ titleVisible: true,
1087
+ announce: announce < AnnounceState.INFO ? AnnounceState.INFO : AnnounceState.DONE
1088
+ };
1089
+ });
1090
+ };
1091
+ _this.handleMediaControlsClose = function (ev) {
1092
+ _this.hideControls();
1093
+ ev.stopPropagation();
1094
+ };
1095
+ _this.setVideoRef = function (video) {
1096
+ _this.video = video;
1097
+ };
1098
+ _this.setTitleRef = function (node) {
1099
+ _this.titleRef = node;
1100
+ };
1101
+ _this.setAnnounceRef = function (node) {
1102
+ _this.announceRef = node;
1103
+ };
1104
+ _this.video = null;
1105
+ _this.pulsedPlaybackRate = null;
1106
+ _this.pulsedPlaybackState = null;
1107
+ _this.prevCommand = _props.noAutoPlay ? 'pause' : 'play';
1108
+ _this.showMiniFeedback = false;
1109
+ _this.speedIndex = 0;
1110
+ _this.seekingMode = true;
1111
+ _this.id = _this.generateId();
1112
+ _this.selectPlaybackRates('fastForward');
1113
+ _this.sliderKnobProportion = 0;
1114
+ _this.mediaControlsSpotlightId = _props.spotlightId + '_mediaControls';
1115
+ _this.jumpButtonPressed = null;
1116
+ _this.playerRef = /*#__PURE__*/(0, _react.createRef)();
1117
+ _this.playbackRate = 1;
1118
+
1119
+ // Re-render-necessary State
1120
+ _this.state = {
1121
+ announce: AnnounceState.READY,
1122
+ currentTime: 0,
1123
+ duration: 0,
1124
+ error: false,
1125
+ loading: false,
1126
+ paused: _props.noAutoPlay,
1127
+ playbackRate: 1,
1128
+ titleOffsetHeight: 0,
1129
+ bottomOffsetHeight: 0,
1130
+ // Non-standard state computed from properties
1131
+ bottomControlsRendered: false,
1132
+ feedbackAction: 'idle',
1133
+ feedbackVisible: false,
1134
+ infoVisible: false,
1135
+ mediaControlsVisible: false,
1136
+ mediaSliderVisible: false,
1137
+ miniFeedbackVisible: false,
1138
+ proportionLoaded: 0,
1139
+ proportionPlayed: 0,
1140
+ sourceUnavailable: true,
1141
+ titleVisible: true
1142
+ };
1143
+ if (_props.setApiProvider) {
1144
+ _props.setApiProvider(_this);
1145
+ }
1146
+ return _this;
1147
+ }
1148
+ _inherits(VideoPlayerBase, _Component);
1149
+ return _createClass(VideoPlayerBase, [{
1150
+ key: "componentDidMount",
1151
+ value: function componentDidMount() {
1152
+ (0, _dispatcher.on)('mousemove', this.activityDetected);
1153
+ if (_platform.platform.touchEvent) {
1154
+ (0, _dispatcher.on)('touchmove', this.activityDetected);
1155
+ }
1156
+ document.addEventListener('keydown', this.handleGlobalKeyDown, {
1157
+ capture: true
1158
+ });
1159
+ document.addEventListener('wheel', this.activityDetected, {
1160
+ capture: true
1161
+ });
1162
+ this.startDelayedFeedbackHide();
1163
+ if (this.context && typeof this.context === 'function') {
1164
+ this.floatingLayerController = this.context(function () {});
1165
+ }
1166
+ }
1167
+ }, {
1168
+ key: "shouldComponentUpdate",
1169
+ value: function shouldComponentUpdate(nextProps, nextState) {
1170
+ if (
1171
+ // Use shallow props compare instead of source comparison to support possible changes
1172
+ // from mediaComponent.
1173
+ (0, _util.shallowEqual)(this.props, nextProps) && !this.state.miniFeedbackVisible && this.state.miniFeedbackVisible === nextState.miniFeedbackVisible && !this.state.mediaSliderVisible && this.state.mediaSliderVisible === nextState.mediaSliderVisible && this.state.loading === nextState.loading && this.props.loading === nextProps.loading && (this.state.currentTime !== nextState.currentTime || this.state.proportionPlayed !== nextState.proportionPlayed || this.state.sliderTooltipTime !== nextState.sliderTooltipTime)) {
1174
+ return false;
1175
+ }
1176
+ return true;
1177
+ }
1178
+ }, {
1179
+ key: "componentDidUpdate",
1180
+ value: function componentDidUpdate(prevProps, prevState) {
1181
+ if (!this.state.mediaControlsVisible && prevState.mediaControlsVisible !== this.state.mediaControlsVisible || !this.state.mediaSliderVisible && prevState.mediaSliderVisible !== this.state.mediaSliderVisible) {
1182
+ this.floatingLayerController.notify({
1183
+ action: 'closeAll'
1184
+ });
1185
+ }
1186
+ if (this.props.spotlightId !== prevProps.spotlightId) {
1187
+ this.mediaControlsSpotlightId = this.props.spotlightId + '_mediaControls';
1188
+ }
1189
+ if (!this.state.mediaControlsVisible && prevState.mediaControlsVisible) {
1190
+ forwardControlsAvailable({
1191
+ available: false
1192
+ }, this.props);
1193
+ this.stopAutoCloseTimeout();
1194
+ if (!this.props.spotlightDisabled) {
1195
+ // If last focused item were in the media controls or slider, we need to explicitly
1196
+ // blur the element when MediaControls hide. See ENYO-5648
1197
+ var current = _spotlight.Spotlight.getCurrent();
1198
+ var bottomControls = document.querySelector(".".concat(_VideoPlayerModule["default"].bottom));
1199
+ if (current && bottomControls && bottomControls.contains(current)) {
1200
+ current.blur();
1201
+ }
1202
+
1203
+ // when in pointer mode, the focus call below will only update the last focused for
1204
+ // the video player and not set the active container to the video player which will
1205
+ // cause focus to land back on the media controls button when spotlight restores
1206
+ // focus.
1207
+ if (_spotlight.Spotlight.getPointerMode()) {
1208
+ _spotlight.Spotlight.setActiveContainer(this.props.spotlightId);
1209
+ }
1210
+
1211
+ // Set focus to the hidden spottable control - maintaining focus on available spottable
1212
+ // controls, which prevents an additional 5-way attempt in order to re-show media controls
1213
+ _spotlight.Spotlight.focus(".".concat(_VideoPlayerModule["default"].controlsHandleAbove));
1214
+ }
1215
+ } else if (this.state.mediaControlsVisible && !prevState.mediaControlsVisible) {
1216
+ forwardControlsAvailable({
1217
+ available: true
1218
+ }, this.props);
1219
+ this.startAutoCloseTimeout();
1220
+ if (!this.props.spotlightDisabled) {
1221
+ var _current = _spotlight.Spotlight.getCurrent();
1222
+ if (!_current || this.playerRef.current.contains(_current)) {
1223
+ // Set focus within media controls when they become visible.
1224
+ if (_spotlight.Spotlight.focus(this.mediaControlsSpotlightId) && this.jumpButtonPressed === 0) {
1225
+ this.jumpButtonPressed = null;
1226
+ }
1227
+ }
1228
+ }
1229
+ }
1230
+
1231
+ // Once video starts loading it queues bottom control render until idle
1232
+ if (this.state.bottomControlsRendered && !prevState.bottomControlsRendered && !this.state.mediaControlsVisible) {
1233
+ this.showControls();
1234
+ }
1235
+ }
1236
+ }, {
1237
+ key: "componentWillUnmount",
1238
+ value: function componentWillUnmount() {
1239
+ (0, _dispatcher.off)('mousemove', this.activityDetected);
1240
+ if (_platform.platform.touchEvent) {
1241
+ (0, _dispatcher.off)('touchmove', this.activityDetected);
1242
+ }
1243
+ document.removeEventListener('keydown', this.handleGlobalKeyDown, {
1244
+ capture: true
1245
+ });
1246
+ document.removeEventListener('wheel', this.activityDetected, {
1247
+ capture: true
1248
+ });
1249
+ this.stopRewindJob();
1250
+ this.stopAutoCloseTimeout();
1251
+ this.stopDelayedTitleHide();
1252
+ this.stopDelayedFeedbackHide();
1253
+ this.stopDelayedMiniFeedbackHide();
1254
+ this.announceJob.stop();
1255
+ this.renderBottomControl.stop();
1256
+ this.slider5WayPressJob.stop();
1257
+ if (this.floatingLayerController) {
1258
+ this.floatingLayerController.unregister();
1259
+ }
1260
+ }
1261
+ }, {
1262
+ key: "isTimeBeyondSelection",
1263
+ value: function isTimeBeyondSelection(time) {
1264
+ var selection = this.props.selection;
1265
+
1266
+ // if selection isn't set or only contains the starting value, there isn't a valid selection
1267
+ // with which to test the time
1268
+ if (selection != null && selection.length >= 2) {
1269
+ var _selection = _slicedToArray(selection, 2),
1270
+ start = _selection[0],
1271
+ end = _selection[1];
1272
+ return time > end || time < start;
1273
+ }
1274
+ return false;
1275
+ }
1276
+ }, {
1277
+ key: "preventTimeChange",
1278
+ value: function preventTimeChange(time) {
1279
+ return this.isTimeBeyondSelection(time) && !(0, _handle.forwardWithPrevent)('onSeekOutsideSelection', {
1280
+ type: 'onSeekOutsideSelection',
1281
+ time: time
1282
+ }, this.props);
1283
+ }
1284
+ }, {
1285
+ key: "getControlsAriaProps",
1286
+ value: function getControlsAriaProps() {
1287
+ if (this.state.announce === AnnounceState.TITLE) {
1288
+ return {
1289
+ 'aria-labelledby': "".concat(this.id, "_mediaTitle_title ").concat(this.id, "_mediaControls_actionGuide"),
1290
+ 'aria-live': 'off',
1291
+ role: 'alert'
1292
+ };
1293
+ } else if (this.state.announce === AnnounceState.INFO) {
1294
+ return {
1295
+ 'aria-labelledby': "".concat(this.id, "_mediaTitle_info"),
1296
+ role: 'region'
1297
+ };
1298
+ }
1299
+ return null;
1300
+ }
1301
+ }, {
1302
+ key: "render",
1303
+ value: function render() {
1304
+ var _this2 = this;
1305
+ var _this$props = this.props,
1306
+ backButtonAriaLabel = _this$props.backButtonAriaLabel,
1307
+ className = _this$props.className,
1308
+ disabled = _this$props.disabled,
1309
+ infoComponents = _this$props.infoComponents,
1310
+ initialJumpDelay = _this$props.initialJumpDelay,
1311
+ jumpDelay = _this$props.jumpDelay,
1312
+ loading = _this$props.loading,
1313
+ locale = _this$props.locale,
1314
+ mediaControlsComponent = _this$props.mediaControlsComponent,
1315
+ no5WayJump = _this$props.no5WayJump,
1316
+ noAutoPlay = _this$props.noAutoPlay,
1317
+ noMiniFeedback = _this$props.noMiniFeedback,
1318
+ noSlider = _this$props.noSlider,
1319
+ noSpinner = _this$props.noSpinner,
1320
+ selection = _this$props.selection,
1321
+ includeTimeHour = _this$props.includeTimeHour,
1322
+ spotlightDisabled = _this$props.spotlightDisabled,
1323
+ spotlightId = _this$props.spotlightId,
1324
+ style = _this$props.style,
1325
+ thumbnailComponent = _this$props.thumbnailComponent,
1326
+ thumbnailSrc = _this$props.thumbnailSrc,
1327
+ title = _this$props.title,
1328
+ VideoComponent = _this$props.videoComponent,
1329
+ mediaProps = _objectWithoutProperties(_this$props, _excluded2);
1330
+ delete mediaProps.announce;
1331
+ delete mediaProps.autoCloseTimeout;
1332
+ delete mediaProps.children;
1333
+ delete mediaProps.feedbackHideDelay;
1334
+ delete mediaProps.jumpBy;
1335
+ delete mediaProps.miniFeedbackHideDelay;
1336
+ delete mediaProps.noAutoShowMediaControls;
1337
+ delete mediaProps.noMediaSliderFeedback;
1338
+ delete mediaProps.onBack;
1339
+ delete mediaProps.onControlsAvailable;
1340
+ delete mediaProps.onFastForward;
1341
+ delete mediaProps.onJumpBackward;
1342
+ delete mediaProps.onJumpForward;
1343
+ delete mediaProps.onPause;
1344
+ delete mediaProps.onPlay;
1345
+ delete mediaProps.onRewind;
1346
+ delete mediaProps.onWillFastForward;
1347
+ delete mediaProps.onWillJumpBackward;
1348
+ delete mediaProps.onWillJumpForward;
1349
+ delete mediaProps.onWillPause;
1350
+ delete mediaProps.onWillPlay;
1351
+ delete mediaProps.onWillRewind;
1352
+ delete mediaProps.onScrub;
1353
+ delete mediaProps.onSeekFailed;
1354
+ delete mediaProps.onSeekOutsideSelection;
1355
+ delete mediaProps.onToggleMore;
1356
+ delete mediaProps.pauseAtEnd;
1357
+ delete mediaProps.playbackRateHash;
1358
+ delete mediaProps.seekDisabled;
1359
+ delete mediaProps.setApiProvider;
1360
+ delete mediaProps.thumbnailUnavailable;
1361
+ delete mediaProps.titleHideDelay;
1362
+ delete mediaProps.videoPath;
1363
+ mediaProps.autoPlay = !noAutoPlay;
1364
+ mediaProps.className = _VideoPlayerModule["default"].video;
1365
+ mediaProps.controls = false;
1366
+ mediaProps.mediaComponent = 'video';
1367
+ mediaProps.onLoadStart = this.handleLoadStart;
1368
+ mediaProps.onUpdate = this.handleEvent;
1369
+ mediaProps.ref = this.setVideoRef;
1370
+ var controlsAriaProps = this.getControlsAriaProps();
1371
+ var proportionSelection = selection;
1372
+ if (proportionSelection != null && this.state.duration) {
1373
+ proportionSelection = selection.map(function (t) {
1374
+ return t / _this2.state.duration;
1375
+ });
1376
+ }
1377
+ var durFmt = getDurFmt(locale);
1378
+ var controlsHandleAboveHoldConfig = getControlsHandleAboveHoldConfig({
1379
+ frequency: jumpDelay,
1380
+ time: initialJumpDelay
1381
+ });
1382
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(RootContainer, {
1383
+ className: _VideoPlayerModule["default"].videoPlayer + ' enact-fit' + (className ? ' ' + className : ''),
1384
+ onClick: this.activityDetected,
1385
+ playerRef: this.playerRef,
1386
+ spotlightDisabled: spotlightDisabled,
1387
+ spotlightId: spotlightId,
1388
+ style: style,
1389
+ children: [
1390
+ // Duplicating logic from <ComponentOverride /> until enzyme supports forwardRef
1391
+ VideoComponent && ((typeof VideoComponent === 'function' || typeof VideoComponent === 'string') && /*#__PURE__*/(0, _jsxRuntime.jsx)(VideoComponent, _objectSpread({}, mediaProps)) || /*#__PURE__*/(0, _react.isValidElement)(VideoComponent) && (/*#__PURE__*/(0, _react.cloneElement)(VideoComponent, mediaProps))) || null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_Overlay["default"], {
1392
+ bottomControlsVisible: this.state.mediaControlsVisible,
1393
+ onClick: this.onVideoClick,
1394
+ children: !noSpinner && (this.state.loading || loading) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner["default"], {
1395
+ centered: true
1396
+ }) : null
1397
+ }), this.state.bottomControlsRendered ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({
1398
+ className: _VideoPlayerModule["default"].fullscreen
1399
+ }, controlsAriaProps), {}, {
1400
+ children: [this.state.mediaControlsVisible ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button["default"], {
1401
+ "aria-label": backButtonAriaLabel == null ? (0, _$L["default"])('go to previous') : backButtonAriaLabel,
1402
+ className: _VideoPlayerModule["default"].back,
1403
+ icon: "arrowhookleft",
1404
+ iconFlip: "auto",
1405
+ onClick: this.handleBack
1406
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(ControlsContainer, {
1407
+ className: _VideoPlayerModule["default"].bottom + (this.state.mediaControlsVisible ? '' : ' ' + _VideoPlayerModule["default"].hidden) + (this.state.infoVisible ? ' ' + _VideoPlayerModule["default"].lift : ''),
1408
+ spotlightDisabled: spotlightDisabled || !this.state.mediaControlsVisible,
1409
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FeedbackContent["default"], {
1410
+ className: _VideoPlayerModule["default"].miniFeedback,
1411
+ playbackRate: this.pulsedPlaybackRate || this.selectPlaybackRate(this.speedIndex),
1412
+ playbackState: this.pulsedPlaybackState || this.prevCommand,
1413
+ visible: this.state.miniFeedbackVisible && !noMiniFeedback,
1414
+ children: (0, _MediaPlayer.secondsToTime)(this.state.sliderTooltipTime, durFmt, {
1415
+ includeHour: true
1416
+ })
1417
+ }), this.state.mediaSliderVisible ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1418
+ className: _VideoPlayerModule["default"].infoFrame,
1419
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_MediaTitle["default"], {
1420
+ id: "".concat(this.id, "_mediaTitle"),
1421
+ infoVisible: this.state.infoVisible,
1422
+ ref: this.setTitleRef,
1423
+ title: title,
1424
+ visible: this.state.titleVisible && this.state.mediaControlsVisible,
1425
+ children: infoComponents
1426
+ }), noSlider ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_MediaPlayer.Times, {
1427
+ current: this.state.currentTime,
1428
+ total: this.state.duration,
1429
+ formatter: durFmt,
1430
+ includeHour: includeTimeHour
1431
+ }) : null]
1432
+ }) : null, noSlider ? null : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1433
+ className: _VideoPlayerModule["default"].sliderContainer,
1434
+ children: [this.state.mediaSliderVisible ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_MediaPlayer.Times, {
1435
+ noTotalTime: true,
1436
+ current: this.state.currentTime,
1437
+ formatter: durFmt,
1438
+ includeHour: includeTimeHour
1439
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_MediaPlayer.MediaSlider, {
1440
+ backgroundProgress: this.state.proportionLoaded,
1441
+ disabled: disabled || this.state.sourceUnavailable,
1442
+ forcePressed: this.state.slider5WayPressed,
1443
+ onBlur: this.handleSliderBlur,
1444
+ onChange: this.onSliderChange,
1445
+ onFocus: this.handleSliderFocus,
1446
+ onKeyDown: this.handleSliderKeyDown,
1447
+ onKnobMove: this.handleKnobMove,
1448
+ selection: proportionSelection,
1449
+ spotlightDisabled: spotlightDisabled || !this.state.mediaControlsVisible,
1450
+ value: this.state.proportionPlayed,
1451
+ visible: this.state.mediaSliderVisible,
1452
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FeedbackTooltip["default"], {
1453
+ action: this.state.feedbackAction,
1454
+ duration: this.state.duration,
1455
+ formatter: durFmt,
1456
+ hidden: !this.state.feedbackVisible || this.state.sourceUnavailable,
1457
+ playbackRate: this.selectPlaybackRate(this.speedIndex),
1458
+ playbackState: this.prevCommand,
1459
+ thumbnailComponent: thumbnailComponent,
1460
+ thumbnailDeactivated: this.props.thumbnailUnavailable,
1461
+ thumbnailSrc: thumbnailSrc
1462
+ })
1463
+ }), this.state.mediaSliderVisible ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_MediaPlayer.Times, {
1464
+ noCurrentTime: true,
1465
+ total: this.state.duration,
1466
+ formatter: durFmt,
1467
+ includeHour: includeTimeHour
1468
+ }) : null]
1469
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ComponentOverride["default"], {
1470
+ component: mediaControlsComponent,
1471
+ id: "".concat(this.id, "_mediaControls"),
1472
+ initialJumpDelay: initialJumpDelay,
1473
+ jumpDelay: jumpDelay,
1474
+ mediaDisabled: disabled || this.state.sourceUnavailable,
1475
+ no5WayJump: no5WayJump,
1476
+ onClose: this.handleMediaControlsClose,
1477
+ onFastForward: this.handleFastForward,
1478
+ onJumpBackwardButtonClick: this.onJumpBackward,
1479
+ onJumpForwardButtonClick: this.onJumpForward,
1480
+ onPause: this.handlePause,
1481
+ onPlay: this.handlePlay,
1482
+ onRewind: this.handleRewind,
1483
+ onToggleMore: this.handleToggleMore,
1484
+ paused: this.state.paused,
1485
+ spotlightId: this.mediaControlsSpotlightId,
1486
+ spotlightDisabled: !this.state.mediaControlsVisible || spotlightDisabled,
1487
+ visible: this.state.mediaControlsVisible
1488
+ })]
1489
+ })]
1490
+ })) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(SpottableDiv
1491
+ // This captures spotlight focus for use with 5-way.
1492
+ // It's non-visible but lives at the top of the VideoPlayer.
1493
+ , {
1494
+ className: _VideoPlayerModule["default"].controlsHandleAbove,
1495
+ holdConfig: controlsHandleAboveHoldConfig,
1496
+ onDown: this.handleControlsHandleAboveDown,
1497
+ onHold: this.handleControlsHandleAboveHold,
1498
+ onKeyDown: this.handleControlsHandleAboveKeyDown,
1499
+ onKeyUp: this.handleControlsHandleAboveKeyUp,
1500
+ onSpotlightDown: this.showControls,
1501
+ selectionKeys: controlsHandleAboveSelectionKeys,
1502
+ spotlightDisabled: this.state.mediaControlsVisible || spotlightDisabled
1503
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Announce["default"], {
1504
+ ref: this.setAnnounceRef
1505
+ })]
1506
+ });
1507
+ }
1508
+ }]);
1509
+ }(_react.Component), _Class.displayName = 'VideoPlayerBase', _Class.propTypes = /** @lends limestone/VideoPlayer.VideoPlayerBase.prototype */{
1510
+ /**
1511
+ * passed by AnnounceDecorator for accessibility
1512
+ *
1513
+ * @type {Function}
1514
+ * @private
1515
+ */
1516
+ announce: _propTypes2["default"].func,
1517
+ /**
1518
+ * The time (in milliseconds) before the control buttons will hide.
1519
+ *
1520
+ * Setting this to 0 or `null` disables closing, requiring user input to open and close.
1521
+ *
1522
+ * @type {Number}
1523
+ * @default 5000
1524
+ * @public
1525
+ */
1526
+ autoCloseTimeout: _propTypes2["default"].number,
1527
+ /**
1528
+ * Sets the hint string read when focusing the back button.
1529
+ *
1530
+ * @type {String}
1531
+ * @default 'go to previous'
1532
+ * @public
1533
+ */
1534
+ backButtonAriaLabel: _propTypes2["default"].string,
1535
+ /**
1536
+ * Removes interactive capability from this component. This includes, but is not limited to,
1537
+ * key-press events, most clickable buttons, and prevents the showing of the controls.
1538
+ *
1539
+ * @type {Boolean}
1540
+ * @public
1541
+ */
1542
+ disabled: _propTypes2["default"].bool,
1543
+ /**
1544
+ * Amount of time (in milliseconds) after which the feedback text/icon part of the slider's
1545
+ * tooltip will automatically hidden after the last action.
1546
+ * Setting this to 0 or `null` disables feedbackHideDelay; feedback will always be present.
1547
+ *
1548
+ * @type {Number}
1549
+ * @default 3000
1550
+ * @public
1551
+ */
1552
+ feedbackHideDelay: _propTypes2["default"].number,
1553
+ /**
1554
+ * Checks if current time and total time should include the hour.
1555
+ *
1556
+ * @type {Boolean}
1557
+ * @default false
1558
+ * @public
1559
+ */
1560
+ includeTimeHour: _propTypes2["default"].bool,
1561
+ /**
1562
+ * Components placed below the title.
1563
+ *
1564
+ * Typically, these will be media descriptor icons, like how many audio channels, what codec
1565
+ * the video uses, but can also be a description for the video or anything else that seems
1566
+ * appropriate to provide information about the video to the user.
1567
+ *
1568
+ * @type {Node}
1569
+ * @public
1570
+ */
1571
+ infoComponents: _propTypes2["default"].node,
1572
+ /**
1573
+ * The number of milliseconds that the player will pause before firing the
1574
+ * first jump event on a right or left pulse.
1575
+ *
1576
+ * @type {Number}
1577
+ * @default 400
1578
+ * @public
1579
+ */
1580
+ initialJumpDelay: _propTypes2["default"].number,
1581
+ /**
1582
+ * The number of seconds the player should skip forward or backward when a "jump" button is
1583
+ * pressed.
1584
+ *
1585
+ * @type {Number}
1586
+ * @default 30
1587
+ * @public
1588
+ */
1589
+ jumpBy: _propTypes2["default"].number,
1590
+ /**
1591
+ * The number of milliseconds that the player will throttle before firing a
1592
+ * jump event on a right or left pulse.
1593
+ *
1594
+ * @type {Number}
1595
+ * @default 200
1596
+ * @public
1597
+ */
1598
+ jumpDelay: _propTypes2["default"].number,
1599
+ /**
1600
+ * Manually set the loading state of the media, in case you have information that
1601
+ * `VideoPlayer` does not have.
1602
+ *
1603
+ * @type {Boolean}
1604
+ * @public
1605
+ */
1606
+ loading: _propTypes2["default"].bool,
1607
+ /**
1608
+ * The current locale as a
1609
+ * {@link https://tools.ietf.org/html/rfc5646|BCP 47 language tag}.
1610
+ *
1611
+ * @type {String}
1612
+ * @public
1613
+ */
1614
+ locale: _propTypes2["default"].string,
1615
+ /**
1616
+ * Overrides the default media control component to support customized behaviors.
1617
+ *
1618
+ * The provided component will receive the following props from `VideoPlayer`:
1619
+ *
1620
+ * * `initialJumpDelay` - Time (in ms) to wait before starting a jump
1621
+ * * `jumpDelay` - - Time (in ms) to wait between jumps
1622
+ * * `mediaDisabled` - `true` when the media controls are not interactive
1623
+ * * `no5WayJump` - `true` when 5-way jumping is disabled
1624
+ * * `onClose` - Called when cancel key is pressed when the media controls are visible
1625
+ * * `onFastForward` - Called when the media is fast forwarded via a key event
1626
+ * * `onJump` - Called when the media jumps either forward or backward
1627
+ * * `onJumpBackwardButtonClick` - Called when the jump backward button is pressed
1628
+ * * `onJumpForwardButtonClick` - Called when the jump forward button is pressed
1629
+ * * `onKeyDown` - Called when a key is pressed
1630
+ * * `onPause` - Called when the media is paused via a key event
1631
+ * * `onPlay` - Called when the media is played via a key event
1632
+ * * `onRewind` - Called when the media is rewound via a key event
1633
+ * * `onToggleMore` - Called when the more components are hidden or shown
1634
+ * * `paused` - `true` when the media is paused
1635
+ * * `spotlightId` - The spotlight container Id for the media controls
1636
+ * * `spotlightDisabled` - `true` when spotlight is disabled for the media controls
1637
+ * * `visible` - `true` when the media controls should be displayed
1638
+ *
1639
+ * @type {Component|Element}
1640
+ * @default limestone/MediaPlayer.MediaControls
1641
+ * @public
1642
+ */
1643
+ mediaControlsComponent: _propTypes["default"].componentOverride,
1644
+ /**
1645
+ * Amount of time (in milliseconds), after the last user action, that the `miniFeedback`
1646
+ * will automatically hide.
1647
+ * Setting this to 0 or `null` disables `miniFeedbackHideDelay`; `miniFeedback` will always
1648
+ * be present.
1649
+ *
1650
+ * @type {Number}
1651
+ * @default 2000
1652
+ * @public
1653
+ */
1654
+ miniFeedbackHideDelay: _propTypes2["default"].number,
1655
+ /**
1656
+ * Disable audio for this video.
1657
+ *
1658
+ * In a TV context, this is handled by the remote control, not programmatically in the
1659
+ * VideoPlayer API.
1660
+ *
1661
+ * @type {Boolean}
1662
+ * @default false
1663
+ * @public
1664
+ */
1665
+ muted: _propTypes2["default"].bool,
1666
+ /**
1667
+ * Prevents the default behavior of using left and right keys for seeking.
1668
+ *
1669
+ * @type {Boolean}
1670
+ * @public
1671
+ */
1672
+ no5WayJump: _propTypes2["default"].bool,
1673
+ /**
1674
+ * Prevents the default behavior of playing a video immediately after it's loaded.
1675
+ *
1676
+ * @type {Boolean}
1677
+ * @default false
1678
+ * @public
1679
+ */
1680
+ noAutoPlay: _propTypes2["default"].bool,
1681
+ /**
1682
+ * Prevents the default behavior of showing media controls immediately after it's loaded.
1683
+ *
1684
+ * @type {Boolean}
1685
+ * @default false
1686
+ * @public
1687
+ */
1688
+ noAutoShowMediaControls: _propTypes2["default"].bool,
1689
+ /**
1690
+ * Hides media slider feedback when fast-forward or rewind while media controls are hidden.
1691
+ *
1692
+ * @type {Boolean}
1693
+ * @default false
1694
+ * @public
1695
+ */
1696
+ noMediaSliderFeedback: _propTypes2["default"].bool,
1697
+ /**
1698
+ * Removes the mini feedback.
1699
+ *
1700
+ * @type {Boolean}
1701
+ * @default false
1702
+ * @public
1703
+ */
1704
+ noMiniFeedback: _propTypes2["default"].bool,
1705
+ /**
1706
+ * Removes the media slider.
1707
+ *
1708
+ * @type {Boolean}
1709
+ * @default false
1710
+ * @public
1711
+ */
1712
+ noSlider: _propTypes2["default"].bool,
1713
+ /**
1714
+ * Removes spinner while loading.
1715
+ *
1716
+ * @type {Boolean}
1717
+ * @public
1718
+ */
1719
+ noSpinner: _propTypes2["default"].bool,
1720
+ /**
1721
+ * Called when the back button is clicked.
1722
+ *
1723
+ * @type {Function}
1724
+ * @public
1725
+ */
1726
+ onBack: _propTypes2["default"].func,
1727
+ /**
1728
+ * Called when the player's controls change availability, whether they are shown
1729
+ * or hidden.
1730
+ *
1731
+ * The current status is sent as the first argument in an object with a key `available`
1732
+ * which will be either `true` or `false`. (e.g.: `onControlsAvailable({available: true})`)
1733
+ *
1734
+ * @type {Function}
1735
+ * @public
1736
+ */
1737
+ onControlsAvailable: _propTypes2["default"].func,
1738
+ /**
1739
+ * Called when the video has been fast forwarded.
1740
+ *
1741
+ * @type {Function}
1742
+ * @public
1743
+ */
1744
+ onFastForward: _propTypes2["default"].func,
1745
+ /**
1746
+ * Called when the user clicks the JumpBackward button.
1747
+ *
1748
+ * Is passed a {@link limestone/VideoPlayer.videoStatus} as the first argument.
1749
+ *
1750
+ * @type {Function}
1751
+ * @public
1752
+ */
1753
+ onJumpBackward: _propTypes2["default"].func,
1754
+ /**
1755
+ * Called when the user clicks the JumpForward button.
1756
+ *
1757
+ * Is passed a {@link limestone/VideoPlayer.videoStatus} as the first argument.
1758
+ *
1759
+ * @type {Function}
1760
+ * @public
1761
+ */
1762
+ onJumpForward: _propTypes2["default"].func,
1763
+ /**
1764
+ * Called when the video has been paused.
1765
+ *
1766
+ * @type {Function}
1767
+ * @public
1768
+ */
1769
+ onPause: _propTypes2["default"].func,
1770
+ /**
1771
+ * Called when the video has been played.
1772
+ *
1773
+ * @type {Function}
1774
+ * @public
1775
+ */
1776
+ onPlay: _propTypes2["default"].func,
1777
+ /**
1778
+ * Called when the video has been rewound.
1779
+ *
1780
+ * @type {Function}
1781
+ * @public
1782
+ */
1783
+ onRewind: _propTypes2["default"].func,
1784
+ /**
1785
+ * Called when the user is moving the VideoPlayer's Slider knob independently of
1786
+ * the current playback position.
1787
+ *
1788
+ * It is passed an object with a `seconds` key (float value) to indicate the current time
1789
+ * index. It can be used to update the `thumbnailSrc` to reflect the current scrub
1790
+ * position.
1791
+ *
1792
+ * @type {Function}
1793
+ * @public
1794
+ */
1795
+ onScrub: _propTypes2["default"].func,
1796
+ /**
1797
+ * Called when seek is attempted while `seekDisabled` is true.
1798
+ *
1799
+ * @type {Function}
1800
+ */
1801
+ onSeekFailed: _propTypes2["default"].func,
1802
+ /**
1803
+ * Called when seeking outside of the current `selection` range.
1804
+ *
1805
+ * By default, the seek will still be performed. Calling `preventDefault()` on the event
1806
+ * will prevent the seek operation.
1807
+ *
1808
+ * @type {Function}
1809
+ * @public
1810
+ */
1811
+ onSeekOutsideSelection: _propTypes2["default"].func,
1812
+ /**
1813
+ * Called when the visibility of more components is changed
1814
+ *
1815
+ * Event payload includes:
1816
+ *
1817
+ * * `type` - Type of event, `'onToggleMore'`
1818
+ * * `showMoreComponents` - `true` when the components are visible`
1819
+ * * `liftDistance` - The distance, in pixels, the component animates
1820
+ *`
1821
+ * @type {Function}
1822
+ * @public
1823
+ */
1824
+ onToggleMore: _propTypes2["default"].func,
1825
+ /**
1826
+ * Called once before the video is forwarded.
1827
+ *
1828
+ * @type {Function}
1829
+ * @public
1830
+ */
1831
+ onWillFastForward: _propTypes2["default"].func,
1832
+ /**
1833
+ * Called once before the video is jump backwarded.
1834
+ *
1835
+ * Is passed a {@link limestone/VideoPlayer.videoStatus} as the first argument.
1836
+ *
1837
+ * @type {Function}
1838
+ * @public
1839
+ */
1840
+ onWillJumpBackward: _propTypes2["default"].func,
1841
+ /**
1842
+ * Called once before the video is jump forwarded.
1843
+ *
1844
+ * Is passed a {@link limestone/VideoPlayer.videoStatus} as the first argument.
1845
+ *
1846
+ * @type {Function}
1847
+ * @public
1848
+ */
1849
+ onWillJumpForward: _propTypes2["default"].func,
1850
+ /**
1851
+ * Called once before the video is paused.
1852
+ *
1853
+ * @type {Function}
1854
+ * @public
1855
+ */
1856
+ onWillPause: _propTypes2["default"].func,
1857
+ /**
1858
+ * Called once before the video is played
1859
+ *
1860
+ * @type {Function}
1861
+ * @public
1862
+ */
1863
+ onWillPlay: _propTypes2["default"].func,
1864
+ /**
1865
+ * Called once before the video is rewound.
1866
+ *
1867
+ * @type {Function}
1868
+ * @public
1869
+ */
1870
+ onWillRewind: _propTypes2["default"].func,
1871
+ /**
1872
+ * Pauses the video when it reaches either the start or the end of the video during rewind,
1873
+ * slow rewind, fast-forward, or slow forward.
1874
+ *
1875
+ * @type {Boolean}
1876
+ * @default false
1877
+ * @public
1878
+ */
1879
+ pauseAtEnd: _propTypes2["default"].bool,
1880
+ /**
1881
+ * Mapping of playback rate names to playback rate values that may be set.
1882
+ *
1883
+ * @type {limestone/VideoPlayer.playbackRateHash}
1884
+ * @default {
1885
+ * fastForward: ['2', '4', '8', '16'],
1886
+ * rewind: ['-2', '-4', '-8', '-16'],
1887
+ * slowForward: ['1/4', '1/2'],
1888
+ * slowRewind: ['-1/2', '-1']
1889
+ * }
1890
+ * @public
1891
+ */
1892
+ playbackRateHash: _propTypes2["default"].shape({
1893
+ fastForward: _propTypes2["default"].arrayOf(_propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number])),
1894
+ rewind: _propTypes2["default"].arrayOf(_propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number])),
1895
+ slowForward: _propTypes2["default"].arrayOf(_propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number])),
1896
+ slowRewind: _propTypes2["default"].arrayOf(_propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]))
1897
+ }),
1898
+ /**
1899
+ * Disables seek function.
1900
+ *
1901
+ * Note that jump by arrow keys will also be disabled when `true`.
1902
+ *
1903
+ * @type {Boolean}
1904
+ * @public
1905
+ */
1906
+ seekDisabled: _propTypes2["default"].bool,
1907
+ /**
1908
+ * A range of the video to display as selected.
1909
+ *
1910
+ * The value of `selection` may either be:
1911
+ * * `null` or `undefined` for no selection,
1912
+ * * a single-element array with the start time of the selection
1913
+ * * a two-element array containing both the start and end time of the selection in seconds
1914
+ *
1915
+ * When the start time is specified, the media slider will show filled starting at that
1916
+ * time to the current time.
1917
+ *
1918
+ * When the end time is specified, the slider's background will be filled between the two
1919
+ * times.
1920
+ *
1921
+ * @type {Number[]}
1922
+ * @public
1923
+ */
1924
+ selection: _propTypes2["default"].arrayOf(_propTypes2["default"].number),
1925
+ /**
1926
+ * Registers the VideoPlayer component with an
1927
+ * {@link core/internal/ApiDecorator.ApiDecorator}.
1928
+ *
1929
+ * @type {Function}
1930
+ * @private
1931
+ */
1932
+ setApiProvider: _propTypes2["default"].func,
1933
+ /**
1934
+ * The video source.
1935
+ *
1936
+ * Any children `<source>` tag elements of {@link limestone/VideoPlayer|VideoPlayer} will
1937
+ * be sent directly to the `videoComponent` as video sources.
1938
+ *
1939
+ * @type {Node}
1940
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source
1941
+ * @public
1942
+ */
1943
+ source: _propTypes2["default"].node,
1944
+ /**
1945
+ * Disables spotlight navigation into the component.
1946
+ *
1947
+ * @type {Boolean}
1948
+ * @public
1949
+ */
1950
+ spotlightDisabled: _propTypes2["default"].bool,
1951
+ /**
1952
+ * The spotlight container ID for the player.
1953
+ *
1954
+ * @type {String}
1955
+ * @public
1956
+ * @default 'videoPlayer'
1957
+ */
1958
+ spotlightId: _propTypes2["default"].string,
1959
+ /**
1960
+ * The thumbnail component to be used instead of the built-in version.
1961
+ *
1962
+ * The internal thumbnail style will not be applied to this component. This component
1963
+ * follows the same rules as the built-in version.
1964
+ *
1965
+ * @type {String|Component|Element}
1966
+ * @public
1967
+ */
1968
+ thumbnailComponent: _propTypes["default"].renderableOverride,
1969
+ /**
1970
+ * Thumbnail image source to show on the slider knob.
1971
+ *
1972
+ * This is a standard {@link limestone/Image} component so it supports all the same
1973
+ * options for the `src` property. If no `thumbnailComponent` and no `thumbnailSrc` is set,
1974
+ * no tooltip will display.
1975
+ *
1976
+ * @type {String|Object}
1977
+ * @public
1978
+ */
1979
+ thumbnailSrc: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]),
1980
+ /**
1981
+ * Enables the thumbnail transition from opaque to translucent.
1982
+ *
1983
+ * @type {Boolean}
1984
+ * @public
1985
+ */
1986
+ thumbnailUnavailable: _propTypes2["default"].bool,
1987
+ /**
1988
+ * Title for the video being played.
1989
+ *
1990
+ * @type {String|Node}
1991
+ * @public
1992
+ */
1993
+ title: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].node]),
1994
+ /**
1995
+ * The time (in milliseconds) before the title disappears from the controls.
1996
+ *
1997
+ * Setting this to `0` disables hiding.
1998
+ *
1999
+ * @type {Number}
2000
+ * @default 5000
2001
+ * @public
2002
+ */
2003
+ titleHideDelay: _propTypes2["default"].number,
2004
+ /**
2005
+ * Video component to use.
2006
+ *
2007
+ * The default renders an `HTMLVideoElement`. Custom video components must have a similar
2008
+ * API structure, exposing the following APIs:
2009
+ *
2010
+ * Properties:
2011
+ * * `currentTime` {Number} - Playback index of the media in seconds
2012
+ * * `duration` {Number} - Media's entire duration in seconds
2013
+ * * `error` {Boolean} - `true` if video playback has errored.
2014
+ * * `loading` {Boolean} - `true` if video playback is loading.
2015
+ * * `paused` {Boolean} - Playing vs paused state. `true` means the media is paused
2016
+ * * `playbackRate` {Number} - Current playback rate, as a number
2017
+ * * `proportionLoaded` {Number} - A value between `0` and `1`
2018
+ * representing the proportion of the media that has loaded
2019
+ * * `proportionPlayed` {Number} - A value between `0` and `1` representing the
2020
+ * proportion of the media that has already been shown
2021
+ *
2022
+ * Events:
2023
+ * * `onLoadStart` - Called when the video starts to load
2024
+ * * `onUpdate` - Sent when any of the properties were updated
2025
+ *
2026
+ * Methods:
2027
+ * * `play()` - play video
2028
+ * * `pause()` - pause video
2029
+ * * `load()` - load video
2030
+ *
2031
+ * The {@link limestone/VideoPlayer.Video.source|source} property is passed to
2032
+ * the video component as a child node.
2033
+ *
2034
+ * @type {Component|Element}
2035
+ * @default {@link ui/Media.Media}
2036
+ * @public
2037
+ */
2038
+ videoComponent: _propTypes["default"].componentOverride
2039
+ }, _Class.contextType = _FloatingLayerDecorator.FloatingLayerContext, _Class.defaultProps = {
2040
+ autoCloseTimeout: 5000,
2041
+ feedbackHideDelay: 3000,
2042
+ includeTimeHour: false,
2043
+ initialJumpDelay: 400,
2044
+ jumpBy: 30,
2045
+ jumpDelay: 200,
2046
+ mediaControlsComponent: _MediaPlayer.MediaControls,
2047
+ miniFeedbackHideDelay: 2000,
2048
+ playbackRateHash: {
2049
+ fastForward: ['2', '4', '8', '16'],
2050
+ rewind: ['-2', '-4', '-8', '-16'],
2051
+ slowForward: ['1/4', '1/2'],
2052
+ slowRewind: ['-1/2', '-1']
2053
+ },
2054
+ spotlightId: 'videoPlayer',
2055
+ titleHideDelay: 5000,
2056
+ videoComponent: _Media["default"]
2057
+ }, _Class);
2058
+
2059
+ /**
2060
+ * A standard HTML5 video player for Limestone. It behaves, responds to, and operates like a
2061
+ * `<video>` tag in its support for `<source>`. It also accepts custom tags such as
2062
+ * `<infoComponents>` for displaying additional information in the title area and `<MediaControls>`
2063
+ * for handling media playback controls and adding more controls.
2064
+ *
2065
+ * Example usage:
2066
+ * ```
2067
+ * <VideoPlayer title="Hilarious Cat Video" poster="https://my.cat.videos/boots-poster.jpg">
2068
+ * <source src="https://my.cat.videos/boots.mp4" type="video/mp4" />
2069
+ * <infoComponents>A video about my cat Boots, wearing boots.</infoComponents>
2070
+ * <MediaControls>
2071
+ * <leftComponents><Button backgroundOpacity="translucent" icon="star" /></leftComponents>
2072
+ * <rightComponents><Button backgroundOpacity="translucent" icon="notification" /></rightComponents>
2073
+ *
2074
+ * <Button backgroundOpacity="translucent">Add To Favorites</Button>
2075
+ * <Button backgroundOpacity="translucent" icon="search" />
2076
+ * </MediaControls>
2077
+ * </VideoPlayer>
2078
+ * ```
2079
+ *
2080
+ * To invoke methods (e.g.: `fastForward()`) or get the current state (`getMediaState()`), store a
2081
+ * ref to the `VideoPlayer` within your component:
2082
+ *
2083
+ * ```
2084
+ * ...
2085
+ *
2086
+ * setVideoPlayer = (node) => {
2087
+ * this.videoPlayer = node;
2088
+ * }
2089
+ *
2090
+ * play () {
2091
+ * this.videoPlayer.play();
2092
+ * }
2093
+ *
2094
+ * render () {
2095
+ * return (
2096
+ * <VideoPlayer ref={this.setVideoPlayer} />
2097
+ * );
2098
+ * }
2099
+ * ```
2100
+ *
2101
+ * @class VideoPlayer
2102
+ * @memberof limestone/VideoPlayer
2103
+ * @mixes ui/Slottable.Slottable
2104
+ * @ui
2105
+ * @public
2106
+ */
2107
+ var VideoPlayer = exports.VideoPlayer = (0, _ApiDecorator["default"])({
2108
+ api: ['areControlsVisible', 'fastForward', 'getMediaState', 'getVideoNode', 'hideControls', 'jump', 'pause', 'play', 'rewind', 'seek', 'setPlaybackSpeed', 'showControls', 'showFeedback', 'toggleControls']
2109
+ }, (0, _I18nDecorator.I18nContextDecorator)({
2110
+ localeProp: 'locale'
2111
+ }, (0, _Slottable["default"])({
2112
+ slots: ['infoComponents', 'mediaControlsComponent', 'source', 'thumbnailComponent', 'videoComponent']
2113
+ }, (0, _FloatingLayer.FloatingLayerDecorator)({
2114
+ floatLayerId: 'videoPlayerFloatingLayer'
2115
+ }, (0, _Skinnable["default"])(VideoPlayerBase)))));
2116
+ var _default = exports["default"] = VideoPlayer;