@24i/bigscreen-sdk 0.9.9-alpha.2147
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -0
- package/package.json +272 -0
- package/packages/adobe-heartbeat/README.md +46 -0
- package/packages/adobe-heartbeat/src/AdobeHeartbeat.ts +244 -0
- package/packages/adobe-heartbeat/src/__external__/Adobe/Adobe.d.ts +24 -0
- package/packages/adobe-heartbeat/src/__external__/Adobe/MediaSDK.min.d.ts +126 -0
- package/packages/adobe-heartbeat/src/__external__/Adobe/MediaSDK.min.js +76 -0
- package/packages/adobe-heartbeat/src/index.ts +5 -0
- package/packages/adobe-heartbeat/src/types.ts +67 -0
- package/packages/animations/README.md +74 -0
- package/packages/animations/src/AnimationUtils.ts +232 -0
- package/packages/animations/src/JSAnimations.ts +142 -0
- package/packages/animations/src/index.ts +3 -0
- package/packages/announcement-banner/README.md +49 -0
- package/packages/announcement-banner/examples/example1.gif +0 -0
- package/packages/announcement-banner/src/AnnouncementBanner.scss +8 -0
- package/packages/announcement-banner/src/AnnouncementBanner.tsx +136 -0
- package/packages/announcement-banner/src/index.ts +1 -0
- package/packages/async-image/README.md +47 -0
- package/packages/async-image/src/AsyncImage.tsx +96 -0
- package/packages/async-image/src/index.ts +2 -0
- package/packages/conviva/README.md +48 -0
- package/packages/conviva/src/ConvivaSDK.ts +38 -0
- package/packages/conviva/src/index.ts +1 -0
- package/packages/conviva/src/theoPlugin/ConvivaConviguration.ts +19 -0
- package/packages/conviva/src/theoPlugin/__external__/Conviva_4.0.15.js +699 -0
- package/packages/conviva/src/theoPlugin/__external__/convivaTheoPlugin.d.ts +7 -0
- package/packages/conviva/src/theoPlugin/__external__/convivaTheoPlugin.js +636 -0
- package/packages/conviva/src/theoPlugin/convivaTheoPluginWrapper.ts +61 -0
- package/packages/conviva/src/theoPlugin/index.ts +2 -0
- package/packages/developer-tools/DeveloperConsole/README.md +114 -0
- package/packages/developer-tools/DeveloperConsole/index.ts +3 -0
- package/packages/developer-tools/DeveloperConsole/unstyled.ts +1 -0
- package/packages/developer-tools/DeveloperToolsService/README.md +54 -0
- package/packages/developer-tools/DeveloperToolsService/index.ts +3 -0
- package/packages/developer-tools/DeveloperToolsService/unstyled.ts +1 -0
- package/packages/developer-tools/EnvironmentSelection/README.md +77 -0
- package/packages/developer-tools/EnvironmentSelection/index.ts +3 -0
- package/packages/developer-tools/EnvironmentSelection/unstyled.ts +1 -0
- package/packages/developer-tools/PlayerDebugWindow/README.md +65 -0
- package/packages/developer-tools/PlayerDebugWindow/index.ts +3 -0
- package/packages/developer-tools/PlayerDebugWindow/unstyled.ts +1 -0
- package/packages/developer-tools/README.md +24 -0
- package/packages/developer-tools/TechnicalInfo/README.md +90 -0
- package/packages/developer-tools/TechnicalInfo/index.ts +9 -0
- package/packages/developer-tools/TechnicalInfo/unstyled.ts +6 -0
- package/packages/developer-tools/src/DeveloperConsole/ControlButton.tsx +16 -0
- package/packages/developer-tools/src/DeveloperConsole/DeveloperConsole.tsx +388 -0
- package/packages/developer-tools/src/DeveloperConsole/Panel.tsx +108 -0
- package/packages/developer-tools/src/DeveloperConsole/PanelMessage.tsx +33 -0
- package/packages/developer-tools/src/DeveloperConsole/helpers/Queue.ts +38 -0
- package/packages/developer-tools/src/DeveloperConsole/helpers/index.ts +2 -0
- package/packages/developer-tools/src/DeveloperConsole/helpers/instrumentHandler.ts +165 -0
- package/packages/developer-tools/src/DeveloperConsole/index.ts +2 -0
- package/packages/developer-tools/src/DeveloperConsole/initDeveloperConsole.tsx +8 -0
- package/packages/developer-tools/src/DeveloperConsole/styles/DeveloperConsole/DeveloperConsole.scss +91 -0
- package/packages/developer-tools/src/DeveloperConsole/styles/DeveloperConsole/DeveloperConsole.styles.1080.scss +2 -0
- package/packages/developer-tools/src/DeveloperConsole/styles/DeveloperConsole/DeveloperConsole.styles.scss +2 -0
- package/packages/developer-tools/src/DeveloperConsole/styles/DeveloperConsole/_sizes.1080.scss +16 -0
- package/packages/developer-tools/src/DeveloperConsole/styles/DeveloperConsole/_sizes.scss +16 -0
- package/packages/developer-tools/src/DeveloperConsole/styles/Panel/Panel.scss +87 -0
- package/packages/developer-tools/src/DeveloperConsole/styles/Panel/Panel.styles.1080.scss +2 -0
- package/packages/developer-tools/src/DeveloperConsole/styles/Panel/Panel.styles.scss +2 -0
- package/packages/developer-tools/src/DeveloperConsole/styles/Panel/_sizes.1080.scss +9 -0
- package/packages/developer-tools/src/DeveloperConsole/styles/Panel/_sizes.scss +9 -0
- package/packages/developer-tools/src/DeveloperConsole/styles.ts +2 -0
- package/packages/developer-tools/src/DeveloperConsole/types.ts +49 -0
- package/packages/developer-tools/src/DeveloperToolsService/DeveloperToolItem.tsx +21 -0
- package/packages/developer-tools/src/DeveloperToolsService/DeveloperToolsList.tsx +114 -0
- package/packages/developer-tools/src/DeveloperToolsService/DeveloperToolsService.tsx +122 -0
- package/packages/developer-tools/src/DeveloperToolsService/index.ts +1 -0
- package/packages/developer-tools/src/DeveloperToolsService/styles/DeveloperToolsService.scss +64 -0
- package/packages/developer-tools/src/DeveloperToolsService/styles/DeveloperToolsService.styles.1080.scss +2 -0
- package/packages/developer-tools/src/DeveloperToolsService/styles/DeveloperToolsService.styles.animated.1080.scss +3 -0
- package/packages/developer-tools/src/DeveloperToolsService/styles/DeveloperToolsService.styles.animated.scss +4 -0
- package/packages/developer-tools/src/DeveloperToolsService/styles/DeveloperToolsService.styles.scss +2 -0
- package/packages/developer-tools/src/DeveloperToolsService/styles/_animated.scss +5 -0
- package/packages/developer-tools/src/DeveloperToolsService/styles/_sizes.1080.scss +16 -0
- package/packages/developer-tools/src/DeveloperToolsService/styles/_sizes.scss +16 -0
- package/packages/developer-tools/src/DeveloperToolsService/styles.ts +1 -0
- package/packages/developer-tools/src/EnvironmentSelection/EnvironmentList.tsx +93 -0
- package/packages/developer-tools/src/EnvironmentSelection/EnvironmentListItem.tsx +73 -0
- package/packages/developer-tools/src/EnvironmentSelection/EnvironmentSelection.tsx +100 -0
- package/packages/developer-tools/src/EnvironmentSelection/assets/checkmark.svg +18 -0
- package/packages/developer-tools/src/EnvironmentSelection/assets/development-stripe.png +0 -0
- package/packages/developer-tools/src/EnvironmentSelection/config.ts +43 -0
- package/packages/developer-tools/src/EnvironmentSelection/constants.ts +1 -0
- package/packages/developer-tools/src/EnvironmentSelection/index.ts +2 -0
- package/packages/developer-tools/src/EnvironmentSelection/sizes.1080.ts +9 -0
- package/packages/developer-tools/src/EnvironmentSelection/sizes.ts +9 -0
- package/packages/developer-tools/src/EnvironmentSelection/styles/EnvironmentSelection.scss +107 -0
- package/packages/developer-tools/src/EnvironmentSelection/styles/EnvironmentSelection.styles.1080.scss +2 -0
- package/packages/developer-tools/src/EnvironmentSelection/styles/EnvironmentSelection.styles.animated.1080.scss +3 -0
- package/packages/developer-tools/src/EnvironmentSelection/styles/EnvironmentSelection.styles.animated.scss +3 -0
- package/packages/developer-tools/src/EnvironmentSelection/styles/EnvironmentSelection.styles.scss +2 -0
- package/packages/developer-tools/src/EnvironmentSelection/styles/_animated.scss +9 -0
- package/packages/developer-tools/src/EnvironmentSelection/styles/_sizes.1080.scss +25 -0
- package/packages/developer-tools/src/EnvironmentSelection/styles/_sizes.scss +25 -0
- package/packages/developer-tools/src/EnvironmentSelection/styles.ts +1 -0
- package/packages/developer-tools/src/EnvironmentSelection/types.ts +10 -0
- package/packages/developer-tools/src/IDeveloperTool.ts +14 -0
- package/packages/developer-tools/src/PlayerDebugWindow/PlayerDebugWindow.tsx +115 -0
- package/packages/developer-tools/src/PlayerDebugWindow/constants.ts +113 -0
- package/packages/developer-tools/src/PlayerDebugWindow/index.ts +1 -0
- package/packages/developer-tools/src/PlayerDebugWindow/styles/PlayerDebugWindow.scss +29 -0
- package/packages/developer-tools/src/PlayerDebugWindow/styles/PlayerDebugWindow.styles.1080.scss +2 -0
- package/packages/developer-tools/src/PlayerDebugWindow/styles/PlayerDebugWindow.styles.scss +2 -0
- package/packages/developer-tools/src/PlayerDebugWindow/styles/_sizes.1080.scss +11 -0
- package/packages/developer-tools/src/PlayerDebugWindow/styles/_sizes.scss +11 -0
- package/packages/developer-tools/src/PlayerDebugWindow/styles.ts +1 -0
- package/packages/developer-tools/src/TechnicalInfo/ITechnicalInfoProvider.ts +5 -0
- package/packages/developer-tools/src/TechnicalInfo/TechnicalInfo.tsx +123 -0
- package/packages/developer-tools/src/TechnicalInfo/TechnicalInfoDetail.tsx +76 -0
- package/packages/developer-tools/src/TechnicalInfo/TechnicalInfoProvider.ts +318 -0
- package/packages/developer-tools/src/TechnicalInfo/icons/arrow-down.svg +18 -0
- package/packages/developer-tools/src/TechnicalInfo/icons/arrow-up.svg +18 -0
- package/packages/developer-tools/src/TechnicalInfo/index.ts +5 -0
- package/packages/developer-tools/src/TechnicalInfo/sizes.1080.ts +1 -0
- package/packages/developer-tools/src/TechnicalInfo/sizes.ts +1 -0
- package/packages/developer-tools/src/TechnicalInfo/styles/TechnicalInfo.scss +186 -0
- package/packages/developer-tools/src/TechnicalInfo/styles/TechnicalInfo.styles.1080.scss +2 -0
- package/packages/developer-tools/src/TechnicalInfo/styles/TechnicalInfo.styles.animated.1080.scss +3 -0
- package/packages/developer-tools/src/TechnicalInfo/styles/TechnicalInfo.styles.animated.scss +3 -0
- package/packages/developer-tools/src/TechnicalInfo/styles/TechnicalInfo.styles.scss +2 -0
- package/packages/developer-tools/src/TechnicalInfo/styles/_animated.scss +16 -0
- package/packages/developer-tools/src/TechnicalInfo/styles/_sizes.1080.scss +50 -0
- package/packages/developer-tools/src/TechnicalInfo/styles/_sizes.scss +50 -0
- package/packages/developer-tools/src/TechnicalInfo/styles.ts +1 -0
- package/packages/developer-tools/src/TechnicalInfo/translations.ts +75 -0
- package/packages/device/README.md +219 -0
- package/packages/device/keymap.ts +1 -0
- package/packages/device/resolver/index.ts +2 -0
- package/packages/device/resolver/keymap.ts +1 -0
- package/packages/device/src/DeviceEventMap.ts +1 -0
- package/packages/device/src/device.ts +6 -0
- package/packages/device/src/driver/index.entone.ts +1 -0
- package/packages/device/src/driver/index.hbbtv.tv.ts +1 -0
- package/packages/device/src/driver/index.kreatv.ts +1 -0
- package/packages/device/src/driver/index.saphi.tv.ts +1 -0
- package/packages/device/src/driver/index.tizen.tv.ts +1 -0
- package/packages/device/src/driver/index.ts +1 -0
- package/packages/device/src/driver/index.webos.tv.ts +1 -0
- package/packages/device/src/getKeyDigit.ts +35 -0
- package/packages/device/src/getKeyMap.ts +4 -0
- package/packages/device/src/index.ts +8 -0
- package/packages/device/src/isClickOrEnter.ts +3 -0
- package/packages/device/src/resolver/index.ts +2 -0
- package/packages/device/src/resolver/resolver.ts +60 -0
- package/packages/digital-clock/README.md +26 -0
- package/packages/digital-clock/src/DigitalClock.tsx +67 -0
- package/packages/digital-clock/src/index.ts +1 -0
- package/packages/driver-base/DeviceBase.md +139 -0
- package/packages/driver-base/README.md +44 -0
- package/packages/driver-base/src/ConnectionType.ts +1 -0
- package/packages/driver-base/src/DeviceBase.ts +218 -0
- package/packages/driver-base/src/KeyMap/Key.ts +41 -0
- package/packages/driver-base/src/KeyMap/KeyMap.ts +386 -0
- package/packages/driver-base/src/KeyMap/generateKeyCodeKeyMap.ts +11 -0
- package/packages/driver-base/src/KeyMap/index.ts +5 -0
- package/packages/driver-base/src/KeyMap/interface.ts +7 -0
- package/packages/driver-base/src/KeyMap/overrideValues.ts +16 -0
- package/packages/driver-base/src/KeyMap/switchByKey.ts +18 -0
- package/packages/driver-base/src/ScreenSize.ts +1 -0
- package/packages/driver-base/src/VolumeRange.ts +5 -0
- package/packages/driver-base/src/bindPreventDefaultEvent.ts +5 -0
- package/packages/driver-base/src/errors.ts +32 -0
- package/packages/driver-base/src/index.ts +10 -0
- package/packages/driver-base/src/loadObject.ts +30 -0
- package/packages/driver-base/src/types/DeviceEvent.ts +9 -0
- package/packages/driver-base/src/types/ExitOptions.ts +1 -0
- package/packages/driver-base/src/types/KeycodeKeyMap.ts +85 -0
- package/packages/driver-base/src/types/ScreenSaverStatus.ts +3 -0
- package/packages/driver-base/src/utils.ts +10 -0
- package/packages/driver-browser/src/DeviceBrowser.ts +170 -0
- package/packages/driver-browser/src/getBrowser.ts +51 -0
- package/packages/driver-browser/src/getOsName.ts +30 -0
- package/packages/driver-browser/src/index.ts +1 -0
- package/packages/driver-browser/src/keymap.ts +14 -0
- package/packages/driver-browser/src/patchSuitestKeys.ts +27 -0
- package/packages/driver-entone/README.md +9 -0
- package/packages/driver-entone/src/DeviceEntone.ts +232 -0
- package/packages/driver-entone/src/IEntone.ts +460 -0
- package/packages/driver-entone/src/constants.ts +73 -0
- package/packages/driver-entone/src/index.ts +1 -0
- package/packages/driver-entone/src/keymap.ts +56 -0
- package/packages/driver-hbbtv/src/DeviceHbbTV.ts +313 -0
- package/packages/driver-hbbtv/src/constants.ts +28 -0
- package/packages/driver-hbbtv/src/deviceInfo.ts +23 -0
- package/packages/driver-hbbtv/src/getVersion.ts +16 -0
- package/packages/driver-hbbtv/src/index.ts +1 -0
- package/packages/driver-hbbtv/src/keymap.ts +45 -0
- package/packages/driver-hbbtv/src/types.ts +366 -0
- package/packages/driver-kreatv/src/DeviceKreaTV.ts +271 -0
- package/packages/driver-kreatv/src/IToi.ts +379 -0
- package/packages/driver-kreatv/src/index.ts +1 -0
- package/packages/driver-kreatv/src/keymap.ts +31 -0
- package/packages/driver-kreatv/src/toi2.ts +107 -0
- package/packages/driver-kreatv/src/toi3.ts +102 -0
- package/packages/driver-kreatv/src/types.ts +35 -0
- package/packages/driver-saphi/src/DeviceSaphi.ts +144 -0
- package/packages/driver-saphi/src/constants.ts +1 -0
- package/packages/driver-saphi/src/formatUserAgent.ts +19 -0
- package/packages/driver-saphi/src/index.ts +1 -0
- package/packages/driver-saphi/src/keymap.ts +64 -0
- package/packages/driver-saphi/src/types.ts +75 -0
- package/packages/driver-tizen/src/DeviceTizen.ts +296 -0
- package/packages/driver-tizen/src/ITizen.ts +212 -0
- package/packages/driver-tizen/src/IWebapis.ts +95 -0
- package/packages/driver-tizen/src/TizenKeys.ts +94 -0
- package/packages/driver-tizen/src/constants.ts +197 -0
- package/packages/driver-tizen/src/index.ts +1 -0
- package/packages/driver-tizen/src/types.ts +14 -0
- package/packages/driver-webos/scripts/exportWebOSTVjs.ts +23 -0
- package/packages/driver-webos/scripts/template.ts +12 -0
- package/packages/driver-webos/src/DeviceWebos.ts +305 -0
- package/packages/driver-webos/src/constants.ts +20 -0
- package/packages/driver-webos/src/index.ts +1 -0
- package/packages/driver-webos/src/keymap.ts +9 -0
- package/packages/driver-webos/src/types.ts +344 -0
- package/packages/driver-webos/src/utils.ts +60 -0
- package/packages/driver-webos/src/webOSTVjs/webOSTVjs-1.2.3/LICENSE-2.0.txt +202 -0
- package/packages/driver-webos/src/webOSTVjs/webOSTVjs-1.2.3/webOSTV-dev.js +1 -0
- package/packages/driver-webos/src/webOSTVjs/webOSTVjs-1.2.3/webOSTV.js +1 -0
- package/packages/driver-xbox/__external__/winjs/directionalnavigation-1.0.0.0.js +1015 -0
- package/packages/driver-xbox/src/DeviceXbox.ts +231 -0
- package/packages/driver-xbox/src/index.ts +1 -0
- package/packages/driver-xbox/src/interfaces.ts +138 -0
- package/packages/driver-xbox/src/keymap.ts +96 -0
- package/packages/driver-xbox/src/utils.ts +23 -0
- package/packages/epg/IMPLEMENTATION.md +228 -0
- package/packages/epg/MockGenerator.md +102 -0
- package/packages/epg/README.md +582 -0
- package/packages/epg/src/v2/Cell.tsx +208 -0
- package/packages/epg/src/v2/CellsManager.ts +1 -0
- package/packages/epg/src/v2/DataManager.ts +301 -0
- package/packages/epg/src/v2/DatePicker.tsx +104 -0
- package/packages/epg/src/v2/DateToast/DateToast.scss +28 -0
- package/packages/epg/src/v2/DateToast/DateToast.styles.1080.scss +2 -0
- package/packages/epg/src/v2/DateToast/DateToast.styles.scss +2 -0
- package/packages/epg/src/v2/DateToast/DateToast.tsx +87 -0
- package/packages/epg/src/v2/DateToast/_sizes.1080.scss +7 -0
- package/packages/epg/src/v2/DateToast/_sizes.scss +7 -0
- package/packages/epg/src/v2/DateToast/index.tsx +1 -0
- package/packages/epg/src/v2/DateToast/styles.ts +1 -0
- package/packages/epg/src/v2/Day.tsx +30 -0
- package/packages/epg/src/v2/Epg.tsx +444 -0
- package/packages/epg/src/v2/Header.tsx +41 -0
- package/packages/epg/src/v2/InputEvents.ts +294 -0
- package/packages/epg/src/v2/MockGenerator/config.1080.ts +2 -0
- package/packages/epg/src/v2/MockGenerator/config.ts +2 -0
- package/packages/epg/src/v2/MockGenerator/generator.ts +173 -0
- package/packages/epg/src/v2/MockGenerator/index.ts +2 -0
- package/packages/epg/src/v2/MockGenerator/mocks/assets/channel_logo_1.png +0 -0
- package/packages/epg/src/v2/MockGenerator/mocks/assets/channel_logo_10.png +0 -0
- package/packages/epg/src/v2/MockGenerator/mocks/assets/channel_logo_11.png +0 -0
- package/packages/epg/src/v2/MockGenerator/mocks/assets/channel_logo_12.png +0 -0
- package/packages/epg/src/v2/MockGenerator/mocks/assets/channel_logo_13.png +0 -0
- package/packages/epg/src/v2/MockGenerator/mocks/assets/channel_logo_14.png +0 -0
- package/packages/epg/src/v2/MockGenerator/mocks/assets/channel_logo_15.png +0 -0
- package/packages/epg/src/v2/MockGenerator/mocks/assets/channel_logo_16.png +0 -0
- package/packages/epg/src/v2/MockGenerator/mocks/assets/channel_logo_17.png +0 -0
- package/packages/epg/src/v2/MockGenerator/mocks/assets/channel_logo_18.png +0 -0
- package/packages/epg/src/v2/MockGenerator/mocks/assets/channel_logo_19.png +0 -0
- package/packages/epg/src/v2/MockGenerator/mocks/assets/channel_logo_2.png +0 -0
- package/packages/epg/src/v2/MockGenerator/mocks/assets/channel_logo_20.png +0 -0
- package/packages/epg/src/v2/MockGenerator/mocks/assets/channel_logo_3.png +0 -0
- package/packages/epg/src/v2/MockGenerator/mocks/assets/channel_logo_4.png +0 -0
- package/packages/epg/src/v2/MockGenerator/mocks/assets/channel_logo_5.png +0 -0
- package/packages/epg/src/v2/MockGenerator/mocks/assets/channel_logo_6.png +0 -0
- package/packages/epg/src/v2/MockGenerator/mocks/assets/channel_logo_7.png +0 -0
- package/packages/epg/src/v2/MockGenerator/mocks/assets/channel_logo_8.png +0 -0
- package/packages/epg/src/v2/MockGenerator/mocks/assets/channel_logo_9.png +0 -0
- package/packages/epg/src/v2/MockGenerator/mocks/data.ts +102 -0
- package/packages/epg/src/v2/MockGenerator/types.ts +25 -0
- package/packages/epg/src/v2/MockGenerator/utils.ts +28 -0
- package/packages/epg/src/v2/MouseNavigation/MouseNavigation.tsx +88 -0
- package/packages/epg/src/v2/MouseNavigation/MouseNavigationFallback.ts +4 -0
- package/packages/epg/src/v2/MouseNavigation/index.tizen.tv.ts +1 -0
- package/packages/epg/src/v2/MouseNavigation/index.ts +1 -0
- package/packages/epg/src/v2/MouseNavigation/index.web.ts +1 -0
- package/packages/epg/src/v2/MouseNavigation/index.webos.tv.ts +1 -0
- package/packages/epg/src/v2/NowLine.tsx +66 -0
- package/packages/epg/src/v2/Program.tsx +58 -0
- package/packages/epg/src/v2/ProgramInfo/ProgramInfo.scss +67 -0
- package/packages/epg/src/v2/ProgramInfo/ProgramInfo.styles.1080.scss +3 -0
- package/packages/epg/src/v2/ProgramInfo/ProgramInfo.styles.animated.1080.scss +2 -0
- package/packages/epg/src/v2/ProgramInfo/ProgramInfo.styles.animated.scss +2 -0
- package/packages/epg/src/v2/ProgramInfo/ProgramInfo.styles.scss +3 -0
- package/packages/epg/src/v2/ProgramInfo/ProgramInfo.tsx +149 -0
- package/packages/epg/src/v2/ProgramInfo/_animated.scss +8 -0
- package/packages/epg/src/v2/ProgramInfo/_mixins.scss +5 -0
- package/packages/epg/src/v2/ProgramInfo/_sizes.1080.scss +21 -0
- package/packages/epg/src/v2/ProgramInfo/_sizes.scss +21 -0
- package/packages/epg/src/v2/ProgramInfo/index.ts +1 -0
- package/packages/epg/src/v2/ProgramInfo/rtl.scss +7 -0
- package/packages/epg/src/v2/ProgramInfo/sizes.1080.ts +3 -0
- package/packages/epg/src/v2/ProgramInfo/sizes.ts +3 -0
- package/packages/epg/src/v2/ProgramInfo/styles.ts +1 -0
- package/packages/epg/src/v2/ProgramInfo/utils.ts +27 -0
- package/packages/epg/src/v2/Row.tsx +132 -0
- package/packages/epg/src/v2/RowsManager.ts +1 -0
- package/packages/epg/src/v2/TimeManager.ts +58 -0
- package/packages/epg/src/v2/Timeline.ts +1 -0
- package/packages/epg/src/v2/TimelineSection.tsx +47 -0
- package/packages/epg/src/v2/basic/CellsManager.tsx +295 -0
- package/packages/epg/src/v2/basic/RowsManager.tsx +500 -0
- package/packages/epg/src/v2/basic/Timeline.tsx +88 -0
- package/packages/epg/src/v2/index.ts +1 -0
- package/packages/epg/src/v2/interface.ts +1489 -0
- package/packages/epg/src/v2/sizes.1080.ts +2 -0
- package/packages/epg/src/v2/sizes.ts +2 -0
- package/packages/epg/src/v2/styles/Basic/Basic.scss +116 -0
- package/packages/epg/src/v2/styles/Basic/index.ts +1 -0
- package/packages/epg/src/v2/styles/Whitelabel/index.ts +1 -0
- package/packages/epg/src/v2/utils.ts +40 -0
- package/packages/events-manager/src/EventsManager.ts +56 -0
- package/packages/events-manager/src/index.ts +2 -0
- package/packages/floating-focus/README.md +64 -0
- package/packages/floating-focus/src/FloatingFocus.ts +106 -0
- package/packages/floating-focus/src/Horizontal.tsx +20 -0
- package/packages/floating-focus/src/Vertical.tsx +20 -0
- package/packages/floating-focus/src/index.ts +4 -0
- package/packages/floating-focus/src/types.ts +20 -0
- package/packages/floating-focus/src/utils.ts +43 -0
- package/packages/focus/README.md +294 -0
- package/packages/focus/src/IFocusable.ts +3 -0
- package/packages/focus/src/Layout/Base.tsx +128 -0
- package/packages/focus/src/Layout/Horizontal.ts +12 -0
- package/packages/focus/src/Layout/Matrix.tsx +305 -0
- package/packages/focus/src/Layout/Vertical.ts +12 -0
- package/packages/focus/src/Layout/__test__/Base.spec.ts +162 -0
- package/packages/focus/src/Layout/__test__/Horizontal.spec.ts +46 -0
- package/packages/focus/src/Layout/__test__/Matrix.spec.ts +261 -0
- package/packages/focus/src/Layout/__test__/Vertical.spec.ts +46 -0
- package/packages/focus/src/Layout/__test__/shared.ts +15 -0
- package/packages/focus/src/Layout/constants.ts +10 -0
- package/packages/focus/src/Layout/types.ts +6 -0
- package/packages/focus/src/__test__/candidate.spec.tsx +245 -0
- package/packages/focus/src/__test__/focusFirstExisting.spec.tsx +21 -0
- package/packages/focus/src/__test__/refocusAfterHashChange.spec.tsx +41 -0
- package/packages/focus/src/__test__/safeFocus.spec.tsx +41 -0
- package/packages/focus/src/candidate.ts +106 -0
- package/packages/focus/src/focusFirstExisting.ts +13 -0
- package/packages/focus/src/index.ts +15 -0
- package/packages/focus/src/refocusAfterHashChange.ts +19 -0
- package/packages/focus/src/safeFocus.ts +15 -0
- package/packages/gallup/README.md +27 -0
- package/packages/gallup/src/Gallup.ts +80 -0
- package/packages/gallup/src/GallupMock.ts +7 -0
- package/packages/gallup/src/__external__/SpringStreams.d.ts +39 -0
- package/packages/gallup/src/__external__/SpringStreams.js +1 -0
- package/packages/gallup/src/index.ts +1 -0
- package/packages/grid/BasicGrid/README.md +78 -0
- package/packages/grid/BasicGrid/examples/example1.gif +0 -0
- package/packages/grid/BasicGrid/examples/example2.gif +0 -0
- package/packages/grid/BasicGrid/index.ts +1 -0
- package/packages/grid/FirstOnlyGrid/README.md +43 -0
- package/packages/grid/FirstOnlyGrid/examples/example1.gif +0 -0
- package/packages/grid/FirstOnlyGrid/index.ts +1 -0
- package/packages/grid/FixedToEndGrid/README.md +45 -0
- package/packages/grid/FixedToEndGrid/examples/example1.gif +0 -0
- package/packages/grid/FixedToEndGrid/index.ts +1 -0
- package/packages/grid/Item/index.ts +1 -0
- package/packages/grid/README.md +150 -0
- package/packages/grid/src/Base/Base.mouse.tsx +24 -0
- package/packages/grid/src/Base/Base.tsx +450 -0
- package/packages/grid/src/Base/index.tizen.tv.ts +1 -0
- package/packages/grid/src/Base/index.ts +1 -0
- package/packages/grid/src/Base/index.webos.tv.ts +1 -0
- package/packages/grid/src/Base/index.webtv.ts +1 -0
- package/packages/grid/src/BasicGrid/BasicGrid.tsx +137 -0
- package/packages/grid/src/BasicGrid/config.ts +13 -0
- package/packages/grid/src/FastFocusingOptimizer/FastFocusingOptimizer.ts +54 -0
- package/packages/grid/src/FirstOnlyGrid/FirstOnlyGrid.tsx +110 -0
- package/packages/grid/src/FirstOnlyGrid/config.ts +13 -0
- package/packages/grid/src/FirstOnlyGrid/controller.ts +10 -0
- package/packages/grid/src/FixedToEndGrid/FixedToEndGrid.tsx +112 -0
- package/packages/grid/src/FixedToEndGrid/config.ts +13 -0
- package/packages/grid/src/FixedToEndGrid/controller.ts +36 -0
- package/packages/grid/src/UnifiedGridController/UnifiedGridController.ts +550 -0
- package/packages/grid/src/UnifiedGridController/index.ts +2 -0
- package/packages/grid/src/UnifiedGridController/interface.ts +92 -0
- package/packages/grid/src/animate.animated.ts +1 -0
- package/packages/grid/src/animate.ts +1 -0
- package/packages/grid/src/interface.ts +28 -0
- package/packages/grid/src/mocks/index.tsx +41 -0
- package/packages/grid/src/types.ts +63 -0
- package/packages/grid/src/utils.ts +69 -0
- package/packages/i18n/README.md +460 -0
- package/packages/i18n/src/I18n.ts +246 -0
- package/packages/i18n/src/Translation.tsx +36 -0
- package/packages/i18n/src/addResourceBundle.ts +73 -0
- package/packages/i18n/src/direction.ts +33 -0
- package/packages/i18n/src/index.ts +4 -0
- package/packages/i18n/src/isRtl.ts +3 -0
- package/packages/i18n/src/middlewares/i18next/Context/Context.ts +25 -0
- package/packages/i18n/src/middlewares/i18next/Context/index.ts +1 -0
- package/packages/i18n/src/middlewares/i18next/Interpolation/Interpolation.ts +95 -0
- package/packages/i18n/src/middlewares/i18next/Interpolation/index.ts +1 -0
- package/packages/i18n/src/middlewares/i18next/Nesting/Nesting.ts +38 -0
- package/packages/i18n/src/middlewares/i18next/Nesting/index.ts +1 -0
- package/packages/i18n/src/middlewares/i18next/Plurals/Plurals.ts +123 -0
- package/packages/i18n/src/middlewares/i18next/Plurals/Resolvers.ts +124 -0
- package/packages/i18n/src/middlewares/i18next/Plurals/index.ts +1 -0
- package/packages/i18n/src/middlewares/i18next/Plurals/types.ts +6 -0
- package/packages/i18n/src/middlewares/icu/DateInterpolation/DateInterpolation.ts +64 -0
- package/packages/i18n/src/middlewares/icu/DateInterpolation/index.ts +1 -0
- package/packages/i18n/src/middlewares/icu/Interpolation/Interpolation.ts +39 -0
- package/packages/i18n/src/middlewares/icu/Interpolation/index.ts +1 -0
- package/packages/i18n/src/middlewares/icu/NumberInterpolation/NumberInterpolation.ts +41 -0
- package/packages/i18n/src/middlewares/icu/NumberInterpolation/index.ts +1 -0
- package/packages/i18n/src/middlewares/icu/Plurals/Plurals.ts +65 -0
- package/packages/i18n/src/middlewares/icu/Plurals/Resolvers.ts +130 -0
- package/packages/i18n/src/middlewares/icu/Plurals/index.ts +1 -0
- package/packages/i18n/src/middlewares/icu/Plurals/types.ts +15 -0
- package/packages/i18n/src/middlewares/icu/Select/Select.ts +36 -0
- package/packages/i18n/src/middlewares/icu/Select/index.ts +1 -0
- package/packages/i18n/src/middlewares/icu/TimeInterpolation/TimeInterpolation.ts +65 -0
- package/packages/i18n/src/middlewares/icu/TimeInterpolation/index.ts +1 -0
- package/packages/i18n/src/middlewares/icu/shared/hasVariable.ts +5 -0
- package/packages/i18n/src/middlewares/icu/shared/matchSwitchCase.ts +80 -0
- package/packages/i18n/src/middlewares/icu/shared/unwrap.ts +1 -0
- package/packages/i18n/src/pluralsCommon/PluralsHelper.ts +54 -0
- package/packages/i18n/src/pluralsCommon/ResolverByLanguage.ts +129 -0
- package/packages/i18n/src/t.tsx +6 -0
- package/packages/i18n/src/typedTranslate.ts +31 -0
- package/packages/i18n/src/types.ts +66 -0
- package/packages/i18n/src/utils.ts +76 -0
- package/packages/icon/README.md +107 -0
- package/packages/icon/src/Icon.tsx +49 -0
- package/packages/icon/src/index.ts +1 -0
- package/packages/ime/README.md +72 -0
- package/packages/ime/src/IKeyboard.ts +6 -0
- package/packages/ime/src/IKeyboardEvent.ts +7 -0
- package/packages/ime/src/ImeManager.ts +33 -0
- package/packages/ime/src/SystemKeyboard/SystemKeyboard.ts +33 -0
- package/packages/ime/src/SystemKeyboard/SystemKeyboardBase.ts +98 -0
- package/packages/ime/src/SystemKeyboard/TizenSystemKeyboard.ts +66 -0
- package/packages/ime/src/SystemKeyboard/WebosSystemKeyboard.ts +74 -0
- package/packages/ime/src/SystemKeyboard/index.tizen.tv.ts +1 -0
- package/packages/ime/src/SystemKeyboard/index.ts +1 -0
- package/packages/ime/src/SystemKeyboard/index.webos.tv.ts +1 -0
- package/packages/ime/src/index.ts +3 -0
- package/packages/input/README.md +62 -0
- package/packages/input/src/Input.scss +5 -0
- package/packages/input/src/Input.tsx +216 -0
- package/packages/input/src/handleOverflow.ts +16 -0
- package/packages/input/src/index.ts +1 -0
- package/packages/interactable/README.md +37 -0
- package/packages/interactable/src/Interactable.tsx +27 -0
- package/packages/interactable/src/index.ts +1 -0
- package/packages/interactable/src/interface.ts +6 -0
- package/packages/ipify/README.md +30 -0
- package/packages/ipify/src/index.ts +1 -0
- package/packages/ipify/src/ipify.ts +41 -0
- package/packages/jsx/README.md +388 -0
- package/packages/jsx/src/Component.ts +68 -0
- package/packages/jsx/src/createRef.ts +5 -0
- package/packages/jsx/src/forwardRef.ts +8 -0
- package/packages/jsx/src/index.ts +31 -0
- package/packages/jsx/src/jsx-runtime.ts +5 -0
- package/packages/jsx/src/manipulation/attachNode.ts +30 -0
- package/packages/jsx/src/manipulation/attachNodeBefore.ts +44 -0
- package/packages/jsx/src/manipulation/clearNode.ts +14 -0
- package/packages/jsx/src/manipulation/detachNode.ts +26 -0
- package/packages/jsx/src/manipulation/index.ts +7 -0
- package/packages/jsx/src/manipulation/removeNode.ts +18 -0
- package/packages/jsx/src/manipulation/replaceNode.ts +42 -0
- package/packages/jsx/src/manipulation/swapNodes.ts +53 -0
- package/packages/jsx/src/mount/guards.ts +26 -0
- package/packages/jsx/src/mount/handleLifecycle.ts +71 -0
- package/packages/jsx/src/mount/index.ts +1 -0
- package/packages/jsx/src/mount/lifecycle.ts +38 -0
- package/packages/jsx/src/mount/lifecycleHelpers.ts +29 -0
- package/packages/jsx/src/mount/mount.ts +141 -0
- package/packages/jsx/src/mount/namespaces.ts +7 -0
- package/packages/jsx/src/mount/props.ts +121 -0
- package/packages/jsx/src/nodeUtils.ts +69 -0
- package/packages/jsx/src/setText.ts +15 -0
- package/packages/jsx/src/test-utils/MountedComponent.ts +50 -0
- package/packages/jsx/src/test-utils/README.md +73 -0
- package/packages/jsx/src/test-utils/click.ts +7 -0
- package/packages/jsx/src/test-utils/enter.ts +4 -0
- package/packages/jsx/src/test-utils/index.ts +5 -0
- package/packages/jsx/src/test-utils/keydown.ts +21 -0
- package/packages/jsx/src/test-utils/shallow.ts +33 -0
- package/packages/jsx/src/test-utils/spec-utils.ts +6 -0
- package/packages/jsx/src/textNode.ts +9 -0
- package/packages/jsx/src/types.ts +128 -0
- package/packages/jsx/src/utils.ts +35 -0
- package/packages/jsx/src/virtualDOM.ts +121 -0
- package/packages/key-sequence/README.md +44 -0
- package/packages/key-sequence/src/KeySequence.ts +56 -0
- package/packages/key-sequence/src/arrayEndsWithKeyCombo.ts +22 -0
- package/packages/key-sequence/src/index.ts +1 -0
- package/packages/key-sequence/src/types.ts +13 -0
- package/packages/keyboard/README.md +235 -0
- package/packages/keyboard/src/AndroidKeyboard/Keyboard.scss +140 -0
- package/packages/keyboard/src/AndroidKeyboard/Keyboard.styles.1080.scss +2 -0
- package/packages/keyboard/src/AndroidKeyboard/Keyboard.styles.animated.1080.scss +3 -0
- package/packages/keyboard/src/AndroidKeyboard/Keyboard.styles.animated.scss +3 -0
- package/packages/keyboard/src/AndroidKeyboard/Keyboard.styles.scss +2 -0
- package/packages/keyboard/src/AndroidKeyboard/Keyboard.tsx +228 -0
- package/packages/keyboard/src/AndroidKeyboard/_animated.scss +7 -0
- package/packages/keyboard/src/AndroidKeyboard/_sizes.1080.scss +15 -0
- package/packages/keyboard/src/AndroidKeyboard/_sizes.scss +15 -0
- package/packages/keyboard/src/AndroidKeyboard/icons/arrow_left.svg +7 -0
- package/packages/keyboard/src/AndroidKeyboard/icons/arrow_right.svg +7 -0
- package/packages/keyboard/src/AndroidKeyboard/icons/key_backspace.svg +13 -0
- package/packages/keyboard/src/AndroidKeyboard/index.ts +1 -0
- package/packages/keyboard/src/AndroidKeyboard/makeLayout.ts +19 -0
- package/packages/keyboard/src/Backdrop/Backdrop.scss +15 -0
- package/packages/keyboard/src/Backdrop/Backdrop.styles.1080.scss +2 -0
- package/packages/keyboard/src/Backdrop/Backdrop.styles.scss +2 -0
- package/packages/keyboard/src/Backdrop/Backdrop.tsx +31 -0
- package/packages/keyboard/src/Backdrop/_sizes.1080.scss +2 -0
- package/packages/keyboard/src/Backdrop/_sizes.scss +2 -0
- package/packages/keyboard/src/DefaultKeyboard/Keyboard.scss +73 -0
- package/packages/keyboard/src/DefaultKeyboard/Keyboard.styles.1080.scss +2 -0
- package/packages/keyboard/src/DefaultKeyboard/Keyboard.styles.scss +2 -0
- package/packages/keyboard/src/DefaultKeyboard/Keyboard.tsx +154 -0
- package/packages/keyboard/src/DefaultKeyboard/_sizes.1080.scss +12 -0
- package/packages/keyboard/src/DefaultKeyboard/_sizes.scss +12 -0
- package/packages/keyboard/src/DefaultKeyboard/index.ts +1 -0
- package/packages/keyboard/src/KeyboardBase.tsx +325 -0
- package/packages/keyboard/src/MobiKeyboard/Keyboard.scss +180 -0
- package/packages/keyboard/src/MobiKeyboard/Keyboard.styles.1080.scss +2 -0
- package/packages/keyboard/src/MobiKeyboard/Keyboard.styles.animated.1080.scss +3 -0
- package/packages/keyboard/src/MobiKeyboard/Keyboard.styles.animated.scss +3 -0
- package/packages/keyboard/src/MobiKeyboard/Keyboard.styles.scss +2 -0
- package/packages/keyboard/src/MobiKeyboard/Keyboard.tsx +267 -0
- package/packages/keyboard/src/MobiKeyboard/_animated.scss +7 -0
- package/packages/keyboard/src/MobiKeyboard/_sizes.1080.scss +10 -0
- package/packages/keyboard/src/MobiKeyboard/_sizes.scss +10 -0
- package/packages/keyboard/src/MobiKeyboard/icons/arrow_left.svg +7 -0
- package/packages/keyboard/src/MobiKeyboard/icons/arrow_right.svg +7 -0
- package/packages/keyboard/src/MobiKeyboard/icons/key_backspace.svg +13 -0
- package/packages/keyboard/src/MobiKeyboard/icons/key_space.svg +7 -0
- package/packages/keyboard/src/MobiKeyboard/index.ts +1 -0
- package/packages/keyboard/src/MobiKeyboard/utils.ts +19 -0
- package/packages/keyboard/src/QwertyKeyboardBase/QwertyKeyboardBase.tsx +54 -0
- package/packages/keyboard/src/ShiftMode.ts +25 -0
- package/packages/keyboard/src/WhitelabelKeyboard/Keyboard.scss +159 -0
- package/packages/keyboard/src/WhitelabelKeyboard/Keyboard.styles.1080.scss +2 -0
- package/packages/keyboard/src/WhitelabelKeyboard/Keyboard.styles.scss +2 -0
- package/packages/keyboard/src/WhitelabelKeyboard/Keyboard.tsx +354 -0
- package/packages/keyboard/src/WhitelabelKeyboard/WhitelabelStyles/_sizes.1080.scss +7 -0
- package/packages/keyboard/src/WhitelabelKeyboard/WhitelabelStyles/_sizes.scss +7 -0
- package/packages/keyboard/src/WhitelabelKeyboard/WhitelabelStyles/index.ts +1 -0
- package/packages/keyboard/src/WhitelabelKeyboard/WhitelabelStyles/whitelabel.scss +77 -0
- package/packages/keyboard/src/WhitelabelKeyboard/WhitelabelStyles/whitelabel.styles.1080.scss +2 -0
- package/packages/keyboard/src/WhitelabelKeyboard/WhitelabelStyles/whitelabel.styles.scss +2 -0
- package/packages/keyboard/src/WhitelabelKeyboard/_sizes.1080.scss +31 -0
- package/packages/keyboard/src/WhitelabelKeyboard/_sizes.scss +31 -0
- package/packages/keyboard/src/WhitelabelKeyboard/focusMatrix.ts +19 -0
- package/packages/keyboard/src/WhitelabelKeyboard/icons/arrow_left.svg +10 -0
- package/packages/keyboard/src/WhitelabelKeyboard/icons/arrow_right.svg +10 -0
- package/packages/keyboard/src/WhitelabelKeyboard/icons/key_backspace.svg +10 -0
- package/packages/keyboard/src/WhitelabelKeyboard/icons/key_shift.svg +10 -0
- package/packages/keyboard/src/WhitelabelKeyboard/icons/key_shift_active.svg +10 -0
- package/packages/keyboard/src/WhitelabelKeyboard/index.ts +2 -0
- package/packages/keyboard/src/WhitelabelKeyboard/types.ts +8 -0
- package/packages/keyboard/src/WhitelabelNumericKeyboard/NumericKeyboard.scss +105 -0
- package/packages/keyboard/src/WhitelabelNumericKeyboard/NumericKeyboard.styles.1080.scss +2 -0
- package/packages/keyboard/src/WhitelabelNumericKeyboard/NumericKeyboard.styles.scss +2 -0
- package/packages/keyboard/src/WhitelabelNumericKeyboard/NumericKeyboard.tsx +158 -0
- package/packages/keyboard/src/WhitelabelNumericKeyboard/WhitelabelStyles/_sizes.1080.scss +7 -0
- package/packages/keyboard/src/WhitelabelNumericKeyboard/WhitelabelStyles/_sizes.scss +7 -0
- package/packages/keyboard/src/WhitelabelNumericKeyboard/WhitelabelStyles/index.ts +1 -0
- package/packages/keyboard/src/WhitelabelNumericKeyboard/WhitelabelStyles/whitelabel.scss +62 -0
- package/packages/keyboard/src/WhitelabelNumericKeyboard/WhitelabelStyles/whitelabel.styles.1080.scss +2 -0
- package/packages/keyboard/src/WhitelabelNumericKeyboard/WhitelabelStyles/whitelabel.styles.scss +2 -0
- package/packages/keyboard/src/WhitelabelNumericKeyboard/_sizes.1080.scss +29 -0
- package/packages/keyboard/src/WhitelabelNumericKeyboard/_sizes.scss +29 -0
- package/packages/keyboard/src/WhitelabelNumericKeyboard/icons/key_backspace.svg +10 -0
- package/packages/keyboard/src/WhitelabelNumericKeyboard/index.ts +2 -0
- package/packages/keyboard/src/WhitelabelNumericKeyboard/layout.ts +14 -0
- package/packages/keyboard/src/hwKeyboardEventToChar.ts +11 -0
- package/packages/keyboard/src/types/index.ts +11 -0
- package/packages/l10n/README.md +102 -0
- package/packages/l10n/interface.ts +1 -0
- package/packages/l10n/locales/cs.ts +4 -0
- package/packages/l10n/locales/en-001.ts +4 -0
- package/packages/l10n/locales/en-us.ts +4 -0
- package/packages/l10n/src/Locale.tsx +44 -0
- package/packages/l10n/src/date/common.ts +153 -0
- package/packages/l10n/src/date/cs.ts +95 -0
- package/packages/l10n/src/date/en-001.ts +76 -0
- package/packages/l10n/src/date/en-common.ts +54 -0
- package/packages/l10n/src/date/en-us.ts +83 -0
- package/packages/l10n/src/date/iso.ts +64 -0
- package/packages/l10n/src/date/types.ts +47 -0
- package/packages/l10n/src/index.ts +2 -0
- package/packages/l10n/src/l10n.ts +54 -0
- package/packages/l10n/src/types.ts +22 -0
- package/packages/list/AttachDetachItem/README.md +128 -0
- package/packages/list/AttachDetachItem/index.ts +3 -0
- package/packages/list/BasicList/README.md +71 -0
- package/packages/list/BasicList/examples/example1.gif +0 -0
- package/packages/list/BasicList/examples/example2.gif +0 -0
- package/packages/list/BasicList/index.ts +1 -0
- package/packages/list/CenteredList/README.md +42 -0
- package/packages/list/CenteredList/examples/example1.gif +0 -0
- package/packages/list/CenteredList/index.ts +1 -0
- package/packages/list/EdgeOffsetList/README.md +58 -0
- package/packages/list/EdgeOffsetList/examples/example1.gif +0 -0
- package/packages/list/EdgeOffsetList/examples/example2.gif +0 -0
- package/packages/list/EdgeOffsetList/index.ts +1 -0
- package/packages/list/FirstOnlyList/README.md +39 -0
- package/packages/list/FirstOnlyList/examples/example1.gif +0 -0
- package/packages/list/FirstOnlyList/index.ts +1 -0
- package/packages/list/FirstOnlyVariedList/README.md +105 -0
- package/packages/list/FirstOnlyVariedList/index.ts +1 -0
- package/packages/list/FixedToEndList/README.md +42 -0
- package/packages/list/FixedToEndList/examples/example1.gif +0 -0
- package/packages/list/FixedToEndList/index.ts +1 -0
- package/packages/list/Item/index.ts +1 -0
- package/packages/list/README.md +176 -0
- package/packages/list/src/AttachDetachItem/AttachDetachItem.tsx +96 -0
- package/packages/list/src/AttachDetachItem/prepareAttachDetachItemData.ts +13 -0
- package/packages/list/src/Base/Base.mouse.tsx +28 -0
- package/packages/list/src/Base/Base.tsx +355 -0
- package/packages/list/src/Base/index.tizen.tv.ts +1 -0
- package/packages/list/src/Base/index.ts +1 -0
- package/packages/list/src/Base/index.webos.tv.ts +1 -0
- package/packages/list/src/Base/index.webtv.ts +1 -0
- package/packages/list/src/BasicList/BasicList.tsx +175 -0
- package/packages/list/src/BasicList/config.ts +13 -0
- package/packages/list/src/CenteredList/CenteredList.tsx +116 -0
- package/packages/list/src/CenteredList/config.ts +13 -0
- package/packages/list/src/CenteredList/controller.ts +47 -0
- package/packages/list/src/CenteredList/interface.ts +10 -0
- package/packages/list/src/EdgeOffsetList/EdgeOffsetList.tsx +172 -0
- package/packages/list/src/EdgeOffsetList/config.ts +13 -0
- package/packages/list/src/FastFocusingOptimizer/FastFocusingOptimizer.ts +54 -0
- package/packages/list/src/FirstOnlyList/FirstOnlyList.tsx +122 -0
- package/packages/list/src/FirstOnlyList/config.ts +13 -0
- package/packages/list/src/FirstOnlyList/controller.ts +11 -0
- package/packages/list/src/FirstOnlyVariedList/FirstOnlyVariedList.tsx +132 -0
- package/packages/list/src/FirstOnlyVariedList/config.ts +13 -0
- package/packages/list/src/FixedToEndList/FixedToEndList.tsx +125 -0
- package/packages/list/src/FixedToEndList/config.ts +13 -0
- package/packages/list/src/FixedToEndList/controller.ts +44 -0
- package/packages/list/src/UnifiedListController/UnifiedListController.ts +254 -0
- package/packages/list/src/UnifiedListController/UnifiedListControllerBase.ts +241 -0
- package/packages/list/src/UnifiedListController/UnifiedVariedListController.ts +241 -0
- package/packages/list/src/UnifiedListController/interface.ts +81 -0
- package/packages/list/src/__test__/utils.spec.ts +59 -0
- package/packages/list/src/animate.animated.ts +1 -0
- package/packages/list/src/animate.ts +1 -0
- package/packages/list/src/index.ts +1 -0
- package/packages/list/src/interface.ts +41 -0
- package/packages/list/src/mocks/index.tsx +55 -0
- package/packages/list/src/types.ts +120 -0
- package/packages/list/src/utils.ts +142 -0
- package/packages/logger/README.md +117 -0
- package/packages/logger/src/LoggerManager.ts +60 -0
- package/packages/logger/src/LoggerService.ts +43 -0
- package/packages/logger/src/index.ts +3 -0
- package/packages/logger/src/loggers/ConsoleLogger/ConsoleLogger.ts +51 -0
- package/packages/logger/src/loggers/ConsoleLogger/README.md +39 -0
- package/packages/logger/src/loggers/ConsoleLogger/index.ts +1 -0
- package/packages/logger/src/loggers/LoggerBase/LoggerBase.ts +67 -0
- package/packages/logger/src/loggers/LoggerBase/README.md +69 -0
- package/packages/logger/src/loggers/LoggerBase/index.ts +1 -0
- package/packages/logger/src/loggers/SentryLogger/README.md +98 -0
- package/packages/logger/src/loggers/SentryLogger/Sentry.ts +1 -0
- package/packages/logger/src/loggers/SentryLogger/SentryLogger.ts +179 -0
- package/packages/logger/src/loggers/SentryLogger/index.ts +2 -0
- package/packages/logger/src/loggers/index.ts +2 -0
- package/packages/logger/src/types.ts +46 -0
- package/packages/lottie-animations/README.md +217 -0
- package/packages/lottie-animations/src/LottieAnimation.tsx +125 -0
- package/packages/lottie-animations/src/index.ts +7 -0
- package/packages/menu/README.md +90 -0
- package/packages/menu/WhitelabelMenu/index.ts +1 -0
- package/packages/menu/WhitelabelMenu/interface.ts +2 -0
- package/packages/menu/WhitelabelMenu/styles.ts +2 -0
- package/packages/menu/interface.ts +3 -0
- package/packages/menu/src/MenuAndContentContainer/MenuAndContentContainer.tsx +166 -0
- package/packages/menu/src/MenuAndContentContainer/index.ts +1 -0
- package/packages/menu/src/MenuAndContentContainer/interface.ts +164 -0
- package/packages/menu/src/MenuAndContentContainer/service.ts +5 -0
- package/packages/menu/src/WhitelabelMenu/SideMenu.scss +41 -0
- package/packages/menu/src/WhitelabelMenu/SideMenu.styles.1080.scss +2 -0
- package/packages/menu/src/WhitelabelMenu/SideMenu.styles.animated.1080.scss +3 -0
- package/packages/menu/src/WhitelabelMenu/SideMenu.styles.animated.scss +3 -0
- package/packages/menu/src/WhitelabelMenu/SideMenu.styles.scss +2 -0
- package/packages/menu/src/WhitelabelMenu/SideMenu.tsx +248 -0
- package/packages/menu/src/WhitelabelMenu/SideMenuItem/SideMenuItem.scss +56 -0
- package/packages/menu/src/WhitelabelMenu/SideMenuItem/SideMenuItem.styles.1080.scss +2 -0
- package/packages/menu/src/WhitelabelMenu/SideMenuItem/SideMenuItem.styles.animated.1080.scss +3 -0
- package/packages/menu/src/WhitelabelMenu/SideMenuItem/SideMenuItem.styles.animated.scss +3 -0
- package/packages/menu/src/WhitelabelMenu/SideMenuItem/SideMenuItem.styles.scss +2 -0
- package/packages/menu/src/WhitelabelMenu/SideMenuItem/SideMenuItem.tsx +78 -0
- package/packages/menu/src/WhitelabelMenu/SideMenuItem/_animated.scss +12 -0
- package/packages/menu/src/WhitelabelMenu/SideMenuItem/_sizes.1080.scss +17 -0
- package/packages/menu/src/WhitelabelMenu/SideMenuItem/_sizes.scss +17 -0
- package/packages/menu/src/WhitelabelMenu/SideMenuItem/index.ts +1 -0
- package/packages/menu/src/WhitelabelMenu/SideMenuItem/interface.ts +49 -0
- package/packages/menu/src/WhitelabelMenu/SideMenuItem/rtl.scss +12 -0
- package/packages/menu/src/WhitelabelMenu/SideMenuItem/sizes.1080.ts +2 -0
- package/packages/menu/src/WhitelabelMenu/SideMenuItem/sizes.ts +2 -0
- package/packages/menu/src/WhitelabelMenu/SideMenuItem/styles.ts +1 -0
- package/packages/menu/src/WhitelabelMenu/VisualController.animated.ts +48 -0
- package/packages/menu/src/WhitelabelMenu/VisualController.ts +20 -0
- package/packages/menu/src/WhitelabelMenu/VisualControllerBase.ts +71 -0
- package/packages/menu/src/WhitelabelMenu/_animated.scss +39 -0
- package/packages/menu/src/WhitelabelMenu/_sizes.1080.scss +14 -0
- package/packages/menu/src/WhitelabelMenu/_sizes.scss +14 -0
- package/packages/menu/src/WhitelabelMenu/assets/shadow.1080.png +0 -0
- package/packages/menu/src/WhitelabelMenu/assets/shadow.720.png +0 -0
- package/packages/menu/src/WhitelabelMenu/constants.animated.ts +1 -0
- package/packages/menu/src/WhitelabelMenu/constants.ts +1 -0
- package/packages/menu/src/WhitelabelMenu/index.ts +1 -0
- package/packages/menu/src/WhitelabelMenu/interface.ts +14 -0
- package/packages/menu/src/WhitelabelMenu/rtl.scss +22 -0
- package/packages/menu/src/WhitelabelMenu/sizes.1080.ts +1 -0
- package/packages/menu/src/WhitelabelMenu/sizes.ts +1 -0
- package/packages/menu/src/WhitelabelMenu/styles.ts +1 -0
- package/packages/menu/src/WhitelabelMenu/utils.ts +34 -0
- package/packages/menu/src/index.ts +2 -0
- package/packages/modal-service/README.md +48 -0
- package/packages/modal-service/src/IModal.ts +3 -0
- package/packages/modal-service/src/ModalService.scss +7 -0
- package/packages/modal-service/src/ModalService.styles.1080.scss +2 -0
- package/packages/modal-service/src/ModalService.styles.scss +2 -0
- package/packages/modal-service/src/ModalService.tsx +76 -0
- package/packages/modal-service/src/_sizes.1080.scss +2 -0
- package/packages/modal-service/src/_sizes.scss +2 -0
- package/packages/modal-service/src/index.ts +2 -0
- package/packages/mouse-navigation/README.md +105 -0
- package/packages/mouse-navigation/src/ArrowNavigation/Arrow.tsx +58 -0
- package/packages/mouse-navigation/src/ArrowNavigation/ArrowNavigation.tsx +95 -0
- package/packages/mouse-navigation/src/ArrowNavigation/__test__/Arrow.spec.tsx +35 -0
- package/packages/mouse-navigation/src/ArrowNavigation/__test__/ArrowNavigation.spec.tsx +45 -0
- package/packages/mouse-navigation/src/ArrowNavigation/index.tsx +1 -0
- package/packages/mouse-navigation/src/MouseElementWrapper.tsx +70 -0
- package/packages/mouse-navigation/src/MouseNavigation.tsx +139 -0
- package/packages/mouse-navigation/src/MouseNavigationInterface.ts +8 -0
- package/packages/mouse-navigation/src/__test__/MouseElementWrapper.spec.tsx +61 -0
- package/packages/mouse-navigation/src/__test__/MouseNavigation.spec.tsx +107 -0
- package/packages/mouse-navigation/src/index.ts +3 -0
- package/packages/numeric-zapper/README.md +153 -0
- package/packages/numeric-zapper/src/NumericZapper.scss +20 -0
- package/packages/numeric-zapper/src/NumericZapper.styles.1080.scss +2 -0
- package/packages/numeric-zapper/src/NumericZapper.styles.scss +2 -0
- package/packages/numeric-zapper/src/NumericZapper.tsx +256 -0
- package/packages/numeric-zapper/src/ZapperAllower.ts +15 -0
- package/packages/numeric-zapper/src/ZapperService.tsx +8 -0
- package/packages/numeric-zapper/src/_sizes.1080.scss +7 -0
- package/packages/numeric-zapper/src/_sizes.scss +7 -0
- package/packages/numeric-zapper/src/index.ts +4 -0
- package/packages/numeric-zapper/src/interface.ts +1 -0
- package/packages/numeric-zapper/src/styles.ts +1 -0
- package/packages/perf-utils/README.md +127 -0
- package/packages/perf-utils/src/array/filter.ts +54 -0
- package/packages/perf-utils/src/array/find.ts +43 -0
- package/packages/perf-utils/src/array/findIndex.ts +43 -0
- package/packages/perf-utils/src/array/forEach.ts +48 -0
- package/packages/perf-utils/src/array/includes.ts +41 -0
- package/packages/perf-utils/src/array/includesNaN.ts +32 -0
- package/packages/perf-utils/src/array/index.ts +7 -0
- package/packages/perf-utils/src/array/map.ts +52 -0
- package/packages/picker/README.md +70 -0
- package/packages/picker/src/DatePicker.tsx +55 -0
- package/packages/picker/src/ModalPicker/Checkbox.tsx +38 -0
- package/packages/picker/src/ModalPicker/PickerItem.tsx +86 -0
- package/packages/picker/src/ModalPicker/PickerModal.tsx +98 -0
- package/packages/picker/src/ModalPicker/index.ts +1 -0
- package/packages/picker/src/ModalPicker/modalPicker.tsx +48 -0
- package/packages/picker/src/Picker.tsx +127 -0
- package/packages/picker/src/index.ts +3 -0
- package/packages/picker/src/types.ts +25 -0
- package/packages/pin-input/README.md +55 -0
- package/packages/pin-input/src/PinInput.scss +5 -0
- package/packages/pin-input/src/PinInput.tsx +169 -0
- package/packages/pin-input/src/index.ts +1 -0
- package/packages/player-ui/README.md +207 -0
- package/packages/player-ui/src/BackwardButton.tsx +41 -0
- package/packages/player-ui/src/CurrentTime.tsx +56 -0
- package/packages/player-ui/src/Duration.tsx +60 -0
- package/packages/player-ui/src/ForwardButton.tsx +41 -0
- package/packages/player-ui/src/PauseButton.tsx +57 -0
- package/packages/player-ui/src/PlayButton.tsx +57 -0
- package/packages/player-ui/src/PlayPauseButton.tsx +63 -0
- package/packages/player-ui/src/PlayerInteractable.tsx +66 -0
- package/packages/player-ui/src/PlayerTime.tsx +55 -0
- package/packages/player-ui/src/PlayerUI.tsx +238 -0
- package/packages/player-ui/src/RemainingTime.tsx +74 -0
- package/packages/player-ui/src/Seekbar.tsx +184 -0
- package/packages/player-ui/src/Seeking.ts +122 -0
- package/packages/player-ui/src/StopButton.tsx +35 -0
- package/packages/player-ui/src/Subtitles.tsx +151 -0
- package/packages/player-ui/src/index.ts +14 -0
- package/packages/player-ui/src/mocks.ts +41 -0
- package/packages/player-ui/src/timeUtils.ts +139 -0
- package/packages/player-ui/src/types.ts +42 -0
- package/packages/progress-bar/README.md +31 -0
- package/packages/progress-bar/src/ProgressBar.tsx +41 -0
- package/packages/progress-bar/src/index.ts +1 -0
- package/packages/progress-bar/src/interface.ts +14 -0
- package/packages/qr-code/README.md +80 -0
- package/packages/qr-code/src/QRCode.tsx +39 -0
- package/packages/qr-code/src/index.ts +2 -0
- package/packages/qr-code/src/qrGenerator/__external__/constants.ts +23 -0
- package/packages/qr-code/src/qrGenerator/__external__/qrcode.d.ts +31 -0
- package/packages/qr-code/src/qrGenerator/__external__/qrcode.js +618 -0
- package/packages/qr-code/src/qrGenerator/generateQr.ts +7 -0
- package/packages/qr-code/src/qrGenerator/index.ts +3 -0
- package/packages/router/README.md +163 -0
- package/packages/router/src/Route.tsx +132 -0
- package/packages/router/src/Router.tsx +174 -0
- package/packages/router/src/focusActiveRoute.ts +5 -0
- package/packages/router/src/history.ts +24 -0
- package/packages/router/src/index.ts +5 -0
- package/packages/router/src/types.ts +13 -0
- package/packages/router/src/utils.ts +24 -0
- package/packages/runtime-config/README.md +37 -0
- package/packages/runtime-config/src/Config.ts +44 -0
- package/packages/runtime-config/src/index.ts +1 -0
- package/packages/sass-utils/README.md +197 -0
- package/packages/sass-utils/src/box-shadow.scss +5 -0
- package/packages/sass-utils/src/ellipsis.scss +15 -0
- package/packages/sass-utils/src/linear-gradient.scss +43 -0
- package/packages/sass-utils/src/prefix-property.scss +7 -0
- package/packages/sass-utils/src/prefix-value.scss +6 -0
- package/packages/sass-utils/src/prefix.scss +6 -0
- package/packages/sass-utils/src/scale.1080.scss +3 -0
- package/packages/sass-utils/src/scale.720.scss +5 -0
- package/packages/sass-utils/src/transform.scss +5 -0
- package/packages/sass-utils/src/transition.scss +6 -0
- package/packages/scheduler/README.md +55 -0
- package/packages/scheduler/src/Scheduler.ts +43 -0
- package/packages/scheduler/src/Task.ts +72 -0
- package/packages/scheduler/src/index.ts +4 -0
- package/packages/scheduler/src/timeProvider.ts +3 -0
- package/packages/scroll-text/README.md +78 -0
- package/packages/scroll-text/src/Base.tsx +141 -0
- package/packages/scroll-text/src/ScrollText.animated.tsx +80 -0
- package/packages/scroll-text/src/ScrollText.tsx +53 -0
- package/packages/scroll-text/src/ScrollTextBaseClass.tsx +86 -0
- package/packages/scroll-text/src/index.ts +1 -0
- package/packages/scroller/README.md +77 -0
- package/packages/scroller/src/Scroller.tsx +51 -0
- package/packages/scroller/src/index.ts +1 -0
- package/packages/splash/AnimatedSplash.ts +1 -0
- package/packages/splash/AnimatedSplashAnimated.ts +1 -0
- package/packages/splash/AnimatedSplashBasic.ts +1 -0
- package/packages/splash/AutomaticSplashAnimated.ts +1 -0
- package/packages/splash/AutomaticSplashBasic.ts +1 -0
- package/packages/splash/README.md +93 -0
- package/packages/splash/StaticSplash.ts +1 -0
- package/packages/splash/StaticSplashAnimated.ts +1 -0
- package/packages/splash/StaticSplashBasic.ts +1 -0
- package/packages/splash/src/AnimatedSplash.animated.tsx +78 -0
- package/packages/splash/src/AnimatedSplash.basic.tsx +37 -0
- package/packages/splash/src/AutomaticSplash.animated.tsx +20 -0
- package/packages/splash/src/AutomaticSplash.basic.tsx +20 -0
- package/packages/splash/src/Splash.scss +8 -0
- package/packages/splash/src/StaticSplash.animated.tsx +48 -0
- package/packages/splash/src/StaticSplash.basic.tsx +26 -0
- package/packages/splash/src/index.animated.ts +1 -0
- package/packages/splash/src/index.ts +1 -0
- package/packages/splash/src/styles.ts +1 -0
- package/packages/splash/src/types.ts +20 -0
- package/packages/storage/README.md +61 -0
- package/packages/storage/src/CookieStorage/CookieStorage.ts +57 -0
- package/packages/storage/src/CookieStorage/index.ts +1 -0
- package/packages/storage/src/LocalStorage/LocalStorage.ts +58 -0
- package/packages/storage/src/LocalStorage/index.ts +1 -0
- package/packages/storage/src/index.ts +2 -0
- package/packages/storage/src/shared.ts +41 -0
- package/packages/storage/src/types.ts +33 -0
- package/packages/throbber/README.md +53 -0
- package/packages/throbber/src/Throbber.scss +52 -0
- package/packages/throbber/src/Throbber.tsx +19 -0
- package/packages/throbber/src/ThrobberService.tsx +55 -0
- package/packages/throbber/src/controlsHandling.ts +14 -0
- package/packages/throbber/src/index.ts +2 -0
- package/packages/time/README.md +113 -0
- package/packages/time/src/Time.ts +245 -0
- package/packages/time/src/adapters/worldTimeApi.ts +74 -0
- package/packages/time/src/constants.ts +13 -0
- package/packages/time/src/index.ts +1 -0
- package/packages/time/src/services/worldTimeApi/index.ts +7 -0
- package/packages/time/src/services/worldTimeApi/types.ts +75 -0
- package/packages/time/src/services/worldTimeApi/worldTimeApi.ts +77 -0
- package/packages/time/src/types.ts +39 -0
- package/packages/time/src/utils.ts +79 -0
- package/packages/toast/README.md +116 -0
- package/packages/toast/src/Toast/IVisualController.ts +7 -0
- package/packages/toast/src/Toast/Toast.scss +22 -0
- package/packages/toast/src/Toast/Toast.styles.1080.scss +2 -0
- package/packages/toast/src/Toast/Toast.styles.scss +2 -0
- package/packages/toast/src/Toast/Toast.tsx +83 -0
- package/packages/toast/src/Toast/VisualController.animated.ts +20 -0
- package/packages/toast/src/Toast/VisualController.ts +9 -0
- package/packages/toast/src/Toast/_sizes.1080.scss +8 -0
- package/packages/toast/src/Toast/_sizes.scss +8 -0
- package/packages/toast/src/Toast/index.ts +2 -0
- package/packages/toast/src/Toast/styles.ts +1 -0
- package/packages/toast/src/ToastService.scss +7 -0
- package/packages/toast/src/ToastService.styles.1080.scss +2 -0
- package/packages/toast/src/ToastService.styles.scss +2 -0
- package/packages/toast/src/ToastService.tsx +48 -0
- package/packages/toast/src/_sizes.1080.scss +2 -0
- package/packages/toast/src/_sizes.scss +2 -0
- package/packages/toast/src/index.ts +4 -0
- package/packages/toast/src/types.ts +4 -0
- package/packages/types-bigscreen-jsx/README.md +11 -0
- package/packages/types-bigscreen-jsx/global.d.ts +155 -0
- package/packages/types-bigscreen-jsx/index.d.ts +3323 -0
- package/packages/types-bigscreen-jsx/index.js +0 -0
- package/packages/types-bigscreen-jsx/src/copyTypes.js +14 -0
- package/packages/volume-control/README.md +79 -0
- package/packages/volume-control/src/IVolumeControlUI.ts +26 -0
- package/packages/volume-control/src/VolumeControlService.tsx +110 -0
- package/packages/volume-control/src/VolumeControlUI/VisualController.animated.ts +28 -0
- package/packages/volume-control/src/VolumeControlUI/VisualController.ts +3 -0
- package/packages/volume-control/src/VolumeControlUI/VisualControllerBase.ts +26 -0
- package/packages/volume-control/src/VolumeControlUI/VolumeControl.scss +18 -0
- package/packages/volume-control/src/VolumeControlUI/VolumeControl.styles.animated.scss +2 -0
- package/packages/volume-control/src/VolumeControlUI/VolumeControl.styles.scss +1 -0
- package/packages/volume-control/src/VolumeControlUI/VolumeControlUI.tsx +80 -0
- package/packages/volume-control/src/VolumeControlUI/_animated.scss +8 -0
- package/packages/volume-control/src/VolumeControlUI/index.ts +1 -0
- package/packages/volume-control/src/index.ts +2 -0
- package/packages/zapping/README.md +88 -0
- package/packages/zapping/src/ChannelZapping.ts +134 -0
- package/packages/zapping/src/Zapping.tsx +105 -0
- package/packages/zapping/src/index.ts +1 -0
- package/packages/zapping/src/interface.ts +1 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { forEach } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
2
|
+
import { EventsManager } from '@24i/bigscreen-sdk/events-manager';
|
|
3
|
+
import { mergeMiddlewares, setupMiddlewares } from './utils';
|
|
4
|
+
import { getDirection } from './direction';
|
|
5
|
+
import {
|
|
6
|
+
Resources,
|
|
7
|
+
TranslationKey,
|
|
8
|
+
TranslationOptions,
|
|
9
|
+
Middlewares,
|
|
10
|
+
NamespaceResource,
|
|
11
|
+
MiddlewareSetup,
|
|
12
|
+
PrivateTranslationOptions,
|
|
13
|
+
KeyModifyingMiddleware,
|
|
14
|
+
ValueModifyingMiddleware,
|
|
15
|
+
} from './types';
|
|
16
|
+
|
|
17
|
+
const DEFAULT_NS = 'translation';
|
|
18
|
+
const DEFAULT_NS_SEPARATOR = ':';
|
|
19
|
+
const DEFAULT_KEY_SEPARATOR = '.';
|
|
20
|
+
const FALLBACK_LNG = 'en';
|
|
21
|
+
|
|
22
|
+
type Options = {
|
|
23
|
+
resources?: Resources,
|
|
24
|
+
lng: string,
|
|
25
|
+
fallbackLng?: string,
|
|
26
|
+
defaultNS?: string,
|
|
27
|
+
keySeparator?: string,
|
|
28
|
+
nsSeparator?: string,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
type Events = {
|
|
32
|
+
'languagechange': () => void,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
class I18n {
|
|
36
|
+
private readonly events = new EventsManager<Events>();
|
|
37
|
+
|
|
38
|
+
addEventListener = this.events.addEventListener;
|
|
39
|
+
|
|
40
|
+
removeEventListener = this.events.removeEventListener;
|
|
41
|
+
|
|
42
|
+
private resources: Resources = {};
|
|
43
|
+
|
|
44
|
+
private lng = '';
|
|
45
|
+
|
|
46
|
+
private fallbackLng: string = FALLBACK_LNG;
|
|
47
|
+
|
|
48
|
+
private defaultNS: string = DEFAULT_NS;
|
|
49
|
+
|
|
50
|
+
private keySeparator: string = DEFAULT_KEY_SEPARATOR;
|
|
51
|
+
|
|
52
|
+
private nsSeparator: string = DEFAULT_NS_SEPARATOR;
|
|
53
|
+
|
|
54
|
+
private readonly middlewares: Middlewares = {
|
|
55
|
+
keyModifying: [],
|
|
56
|
+
valueModifying: [],
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
init({
|
|
60
|
+
resources = {},
|
|
61
|
+
lng,
|
|
62
|
+
fallbackLng = FALLBACK_LNG,
|
|
63
|
+
defaultNS = DEFAULT_NS,
|
|
64
|
+
keySeparator = DEFAULT_KEY_SEPARATOR,
|
|
65
|
+
nsSeparator = DEFAULT_NS_SEPARATOR,
|
|
66
|
+
}: Options) {
|
|
67
|
+
this.resources = resources;
|
|
68
|
+
this.lng = lng;
|
|
69
|
+
this.fallbackLng = fallbackLng;
|
|
70
|
+
this.defaultNS = defaultNS;
|
|
71
|
+
this.keySeparator = keySeparator;
|
|
72
|
+
this.nsSeparator = nsSeparator;
|
|
73
|
+
this.setDocumentDir();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
t(translationKey: TranslationKey, passedOptions: TranslationOptions | string = {}): string {
|
|
77
|
+
const options: TranslationOptions = typeof passedOptions === 'string'
|
|
78
|
+
? { defaultValue: passedOptions }
|
|
79
|
+
: passedOptions;
|
|
80
|
+
if (typeof translationKey === 'string') {
|
|
81
|
+
return (
|
|
82
|
+
this.translateSingleKey(translationKey, options)
|
|
83
|
+
|| this.runValueModifyingMiddlewares(options.defaultValue, options)
|
|
84
|
+
|| translationKey
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
const translationKeysLength = translationKey.length;
|
|
88
|
+
for (let i = 0; i < translationKeysLength; i++) {
|
|
89
|
+
const translation = this.translateSingleKey(translationKey[i], options);
|
|
90
|
+
if (translation) return translation;
|
|
91
|
+
}
|
|
92
|
+
return (
|
|
93
|
+
this.runValueModifyingMiddlewares(options.defaultValue, options)
|
|
94
|
+
|| translationKey[translationKeysLength - 1]
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
middleware(...middlewares: MiddlewareSetup[]) {
|
|
99
|
+
setupMiddlewares(
|
|
100
|
+
middlewares,
|
|
101
|
+
this.middlewares.keyModifying,
|
|
102
|
+
this.middlewares.valueModifying,
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
getLanguage(): string {
|
|
107
|
+
return this.lng;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
getLanguages(): string[] {
|
|
111
|
+
return Object.keys(this.resources);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
setLanguage(lng: string) {
|
|
115
|
+
this.lng = lng;
|
|
116
|
+
this.setDocumentDir();
|
|
117
|
+
this.events.triggerEvent('languagechange');
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
getResources() {
|
|
121
|
+
return this.resources;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
setResources(resources: Resources) {
|
|
125
|
+
this.resources = resources;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
dir(language: string = this.lng) {
|
|
129
|
+
return getDirection(language);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
setDocumentDir() {
|
|
133
|
+
document.dir = this.dir();
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private translateSingleKey(translationKey: string, options: TranslationOptions) {
|
|
137
|
+
const privateOptions: PrivateTranslationOptions = { ...options };
|
|
138
|
+
const { ns, pathWithKey } = this.getNSAndPath(translationKey, privateOptions);
|
|
139
|
+
const { resources, language } = this.getResourcesAndUsedLanguage(privateOptions);
|
|
140
|
+
privateOptions.language = language;
|
|
141
|
+
this.prepareMergedMiddlewares(privateOptions);
|
|
142
|
+
if (!resources) return undefined;
|
|
143
|
+
const namespace = resources[ns];
|
|
144
|
+
if (!namespace) return undefined;
|
|
145
|
+
const translation = this.getTranslationFromNamespace(
|
|
146
|
+
namespace, pathWithKey, privateOptions,
|
|
147
|
+
);
|
|
148
|
+
if (!translation) return undefined;
|
|
149
|
+
return this.runValueModifyingMiddlewares(translation, privateOptions);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
private getResourcesAndUsedLanguage(options: PrivateTranslationOptions) {
|
|
153
|
+
const primaryLanguage = options.lng || this.lng;
|
|
154
|
+
const primaryResources = this.resources[primaryLanguage];
|
|
155
|
+
if (primaryResources) {
|
|
156
|
+
return {
|
|
157
|
+
resources: primaryResources,
|
|
158
|
+
language: primaryLanguage,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
const fallbackLanguage = options.fallbackLng || this.fallbackLng;
|
|
162
|
+
return {
|
|
163
|
+
resources: this.resources[fallbackLanguage],
|
|
164
|
+
language: fallbackLanguage,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
private getNSAndPath(translationKey: string, options: PrivateTranslationOptions) {
|
|
169
|
+
const parts = translationKey.split(options.nsSeparator || this.nsSeparator);
|
|
170
|
+
const isNSInTranslationKey = parts.length === 2;
|
|
171
|
+
const ns = isNSInTranslationKey ? parts[0] : options.ns || this.defaultNS;
|
|
172
|
+
const pathWithKey = isNSInTranslationKey ? parts[1] : parts[0];
|
|
173
|
+
return { ns, pathWithKey };
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
private getTranslationFromNamespace(
|
|
177
|
+
namespace: NamespaceResource,
|
|
178
|
+
pathWithKey: string,
|
|
179
|
+
options: PrivateTranslationOptions,
|
|
180
|
+
) {
|
|
181
|
+
const { key, pathParts } = this.getPathPartsAndKey(pathWithKey, options);
|
|
182
|
+
let currentNamespace: any = namespace;
|
|
183
|
+
const pathPartsLength = pathParts.length;
|
|
184
|
+
for (let i = 0; i < pathPartsLength; i++) {
|
|
185
|
+
currentNamespace = currentNamespace[pathParts[i]];
|
|
186
|
+
if (!currentNamespace) return undefined;
|
|
187
|
+
}
|
|
188
|
+
const finalKey = this.runKeyModifyingMiddlewares(key, currentNamespace, options);
|
|
189
|
+
return currentNamespace[finalKey];
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
private getPathPartsAndKey(pathWithKey: string, { keySeparator }: PrivateTranslationOptions) {
|
|
193
|
+
const pathParts = pathWithKey.split(keySeparator || this.keySeparator);
|
|
194
|
+
const [key] = pathParts.splice(pathParts.length - 1, 1);
|
|
195
|
+
return { key, pathParts };
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
private prepareMergedMiddlewares(privateOptions: PrivateTranslationOptions) {
|
|
199
|
+
const translationKeyModifyingMiddlewares: KeyModifyingMiddleware[] = [];
|
|
200
|
+
const translationValueModifyingMiddlewares: ValueModifyingMiddleware[] = [];
|
|
201
|
+
const { middlewares } = privateOptions;
|
|
202
|
+
setupMiddlewares(
|
|
203
|
+
middlewares,
|
|
204
|
+
translationKeyModifyingMiddlewares,
|
|
205
|
+
translationValueModifyingMiddlewares,
|
|
206
|
+
);
|
|
207
|
+
privateOptions.keyModifyingMiddlewares = mergeMiddlewares(
|
|
208
|
+
translationKeyModifyingMiddlewares,
|
|
209
|
+
this.middlewares.keyModifying,
|
|
210
|
+
);
|
|
211
|
+
privateOptions.valueModifyingMiddlewares = mergeMiddlewares(
|
|
212
|
+
translationValueModifyingMiddlewares,
|
|
213
|
+
this.middlewares.valueModifying,
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
private runKeyModifyingMiddlewares(
|
|
218
|
+
key: string,
|
|
219
|
+
namespace: NamespaceResource,
|
|
220
|
+
options: PrivateTranslationOptions,
|
|
221
|
+
) {
|
|
222
|
+
let currentKey = key;
|
|
223
|
+
const { keyModifyingMiddlewares = [] } = options;
|
|
224
|
+
const middlewares = keyModifyingMiddlewares;
|
|
225
|
+
forEach(middlewares, ({ middleware }) => {
|
|
226
|
+
currentKey = middleware(currentKey, namespace, options);
|
|
227
|
+
});
|
|
228
|
+
return currentKey;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
private runValueModifyingMiddlewares(
|
|
232
|
+
value: string | undefined,
|
|
233
|
+
options: PrivateTranslationOptions,
|
|
234
|
+
) {
|
|
235
|
+
if (typeof value === 'undefined') return undefined;
|
|
236
|
+
let currentValue = value;
|
|
237
|
+
const { valueModifyingMiddlewares = [] } = options;
|
|
238
|
+
const middlewares = valueModifyingMiddlewares;
|
|
239
|
+
forEach(middlewares, ({ middleware }) => {
|
|
240
|
+
currentValue = middleware(currentValue, options);
|
|
241
|
+
});
|
|
242
|
+
return currentValue;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export const i18n = new I18n();
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Component, createRef, TextNode } from '@24i/bigscreen-sdk/jsx';
|
|
2
|
+
import { i18n } from './I18n';
|
|
3
|
+
import { TranslationKey, TranslationOptions } from './types';
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
translationKey: TranslationKey,
|
|
7
|
+
options?: TranslationOptions | string,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export class Translation extends Component<Props> {
|
|
11
|
+
textNode = createRef<Text>();
|
|
12
|
+
|
|
13
|
+
static defaultProps = {
|
|
14
|
+
options: {},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
componentDidMount() {
|
|
18
|
+
i18n.addEventListener('languagechange', this.onLanguageChange);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
componentWillUnmount() {
|
|
22
|
+
i18n.removeEventListener('languagechange', this.onLanguageChange);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
onLanguageChange = () => {
|
|
26
|
+
const { translationKey, options } = this.props;
|
|
27
|
+
if (!this.textNode.current) return;
|
|
28
|
+
this.textNode.current.nodeValue = i18n.t(translationKey, options);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// @ts-ignore - Special case for BIGscreen JSX incompatible with types/react
|
|
32
|
+
render() {
|
|
33
|
+
const { translationKey, options } = this.props;
|
|
34
|
+
return <TextNode ref={this.textNode}>{i18n.t(translationKey, options)}</TextNode>;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { forEach } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
2
|
+
import { i18n } from './I18n';
|
|
3
|
+
import { NamespaceResource, Resources } from './types';
|
|
4
|
+
|
|
5
|
+
const DEFAULT_DEEP = false;
|
|
6
|
+
const DEFAULT_OVERWRITE = false;
|
|
7
|
+
|
|
8
|
+
const addNewLanguage = (
|
|
9
|
+
resource: Resources,
|
|
10
|
+
language: string,
|
|
11
|
+
namespace: string,
|
|
12
|
+
newResource: NamespaceResource,
|
|
13
|
+
) => {
|
|
14
|
+
resource[language] = {
|
|
15
|
+
[namespace]: newResource,
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const addNewNamespace = (
|
|
20
|
+
resource: Resources,
|
|
21
|
+
language: string,
|
|
22
|
+
namespace: string,
|
|
23
|
+
newResource: NamespaceResource,
|
|
24
|
+
) => {
|
|
25
|
+
resource[language][namespace] = newResource;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const mergeNamespace = (
|
|
29
|
+
nsResource: NamespaceResource,
|
|
30
|
+
newResource: NamespaceResource,
|
|
31
|
+
overwrite: boolean = DEFAULT_OVERWRITE,
|
|
32
|
+
) => {
|
|
33
|
+
forEach(Object.keys(newResource), (key) => {
|
|
34
|
+
if (typeof nsResource[key] === 'undefined') {
|
|
35
|
+
nsResource[key] = newResource[key];
|
|
36
|
+
} else if (typeof nsResource[key] === 'string') {
|
|
37
|
+
if (!overwrite) return;
|
|
38
|
+
nsResource[key] = newResource[key];
|
|
39
|
+
} else if (typeof newResource[key] === 'string' && overwrite) { // nsResource[key] is object
|
|
40
|
+
nsResource[key] = newResource[key];
|
|
41
|
+
} else { // newResource[key] is also an object
|
|
42
|
+
mergeNamespace(
|
|
43
|
+
nsResource[key] as NamespaceResource,
|
|
44
|
+
newResource[key] as NamespaceResource,
|
|
45
|
+
overwrite,
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const addResourceBundle = (
|
|
52
|
+
language: string,
|
|
53
|
+
namespace: string,
|
|
54
|
+
resource: NamespaceResource,
|
|
55
|
+
deep: boolean = DEFAULT_DEEP,
|
|
56
|
+
overwrite: boolean = DEFAULT_OVERWRITE,
|
|
57
|
+
) => {
|
|
58
|
+
const currentResources = i18n.getResources();
|
|
59
|
+
const shouldAddNewLanguage = !currentResources[language];
|
|
60
|
+
if (shouldAddNewLanguage) {
|
|
61
|
+
addNewLanguage(currentResources, language, namespace, resource);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const shouldAddNewNamespace = (
|
|
65
|
+
(currentResources[language] && !currentResources[language][namespace])
|
|
66
|
+
|| !deep
|
|
67
|
+
);
|
|
68
|
+
if (shouldAddNewNamespace) {
|
|
69
|
+
addNewNamespace(currentResources, language, namespace, resource);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
mergeNamespace(currentResources[language][namespace], resource, overwrite);
|
|
73
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { includes } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Codes of all RTL languages in ISO_639-1 format (ISO_639-2 for those not defined in -1)
|
|
5
|
+
*/
|
|
6
|
+
const RTL_LANGUAGES = [
|
|
7
|
+
'ar', 'shu', 'sqr', 'ssh', 'xaa', 'yhd', 'yud', 'aao', 'abh',
|
|
8
|
+
'abv', 'acm', 'acq', 'acw', 'acx', 'acy', 'adf', 'ads', 'aeb',
|
|
9
|
+
'aec', 'afb', 'ajp', 'apc', 'apd', 'arb', 'arq', 'ars', 'ary',
|
|
10
|
+
'arz', 'auz', 'avl', 'ayh', 'ayl', 'ayn', 'ayp', 'bbz', 'pga',
|
|
11
|
+
'he', 'iw', 'ps', 'pbt', 'pbu', 'pst', 'prp', 'prd', 'ug', 'ur',
|
|
12
|
+
'ydd', 'yds', 'yih', 'ji', 'yi', 'hbo', 'men', 'xmn', 'fa', 'jpr',
|
|
13
|
+
'peo', 'pes', 'prs', 'dv', 'sam',
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
type Direction = 'ltr' | 'rtl';
|
|
17
|
+
|
|
18
|
+
const cache: Record<string, Direction> = {};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Returns text direction for a language
|
|
22
|
+
* @param languageAndRegion ISO_639-1 code of language (can be with -region) or ISO_639-2 for
|
|
23
|
+
* languages not defined in ISO_639-1
|
|
24
|
+
*/
|
|
25
|
+
export const getDirection = (languageAndRegion: string): Direction => {
|
|
26
|
+
const [language] = languageAndRegion.split('-');
|
|
27
|
+
if (!cache[language]) {
|
|
28
|
+
cache[language] = includes(RTL_LANGUAGES, language)
|
|
29
|
+
? 'rtl'
|
|
30
|
+
: 'ltr';
|
|
31
|
+
}
|
|
32
|
+
return cache[language];
|
|
33
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
KeyModifyingMiddleware,
|
|
3
|
+
MiddlewareSetup,
|
|
4
|
+
PrivateTranslationOptions,
|
|
5
|
+
Translation,
|
|
6
|
+
} from '../../../types';
|
|
7
|
+
|
|
8
|
+
const lookForContext: KeyModifyingMiddleware['middleware'] = (
|
|
9
|
+
key: string, namespace: Record<string, Translation>, { context }: PrivateTranslationOptions,
|
|
10
|
+
) => {
|
|
11
|
+
if (typeof context !== 'string') return key;
|
|
12
|
+
const contextedKey = `${key}_${context}`;
|
|
13
|
+
if (typeof namespace[contextedKey] === 'string') return contextedKey;
|
|
14
|
+
return key;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const Context: MiddlewareSetup = () => ({
|
|
18
|
+
keyModifying: [
|
|
19
|
+
{
|
|
20
|
+
priority: 1,
|
|
21
|
+
name: 'context-key-modifier',
|
|
22
|
+
middleware: lookForContext,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Context } from './Context';
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { forEach, map } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
2
|
+
import {
|
|
3
|
+
InterpolationOptions,
|
|
4
|
+
MiddlewareSetup,
|
|
5
|
+
TranslationOptions,
|
|
6
|
+
ValueModifyingMiddleware,
|
|
7
|
+
} from '../../../types';
|
|
8
|
+
|
|
9
|
+
const DEFAULT_SEPARATOR = ',';
|
|
10
|
+
const DEFAULT_PREFIX = '{{';
|
|
11
|
+
const DEFAULT_SUFFIX = '}}';
|
|
12
|
+
const KEY_SEPARATOR = '.';
|
|
13
|
+
|
|
14
|
+
const getValueFromObject = (keyName: string, options: Record<string, any>) => {
|
|
15
|
+
const keyParts = keyName.split(KEY_SEPARATOR);
|
|
16
|
+
const keyPartsLength = keyParts.length;
|
|
17
|
+
let part = options;
|
|
18
|
+
for (let i = 0; i < keyPartsLength; i++) {
|
|
19
|
+
part = part[keyParts[i]];
|
|
20
|
+
if (typeof part === 'undefined' || part === null) return undefined;
|
|
21
|
+
}
|
|
22
|
+
return part as unknown as string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const getKeyNameAndValueFormat = (
|
|
26
|
+
keyNameAndFormat: string,
|
|
27
|
+
{ format, formatSeparator = DEFAULT_SEPARATOR }: InterpolationOptions = {},
|
|
28
|
+
) => {
|
|
29
|
+
if (typeof format === 'undefined') {
|
|
30
|
+
return {
|
|
31
|
+
keyName: keyNameAndFormat,
|
|
32
|
+
valueFormat: undefined,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const [keyName, valueFormat] = map(
|
|
36
|
+
keyNameAndFormat.split(formatSeparator),
|
|
37
|
+
(s: string) => s.trim(),
|
|
38
|
+
);
|
|
39
|
+
return { keyName, valueFormat };
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const interpolateMatch = (
|
|
43
|
+
interpolatedValue: string,
|
|
44
|
+
keyNameAndFormat: string,
|
|
45
|
+
match: string,
|
|
46
|
+
options: TranslationOptions,
|
|
47
|
+
): string => {
|
|
48
|
+
const { interpolation = {} } = options;
|
|
49
|
+
const {
|
|
50
|
+
keyName,
|
|
51
|
+
valueFormat,
|
|
52
|
+
} = getKeyNameAndValueFormat(keyNameAndFormat, interpolation);
|
|
53
|
+
const value = keyName.indexOf(KEY_SEPARATOR) === -1
|
|
54
|
+
? options[keyName]
|
|
55
|
+
: getValueFromObject(keyName, options);
|
|
56
|
+
if (typeof value === 'undefined') return interpolatedValue;
|
|
57
|
+
const { format } = interpolation;
|
|
58
|
+
return (
|
|
59
|
+
typeof format === 'function'
|
|
60
|
+
? interpolatedValue.replace(match, format(value, valueFormat))
|
|
61
|
+
: interpolatedValue.replace(match, value)
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const interpolate: ValueModifyingMiddleware['middleware'] = (
|
|
66
|
+
value: string, options: TranslationOptions,
|
|
67
|
+
): string => {
|
|
68
|
+
const { interpolation = {} } = options;
|
|
69
|
+
const {
|
|
70
|
+
prefix = DEFAULT_PREFIX,
|
|
71
|
+
suffix = DEFAULT_SUFFIX,
|
|
72
|
+
formatSeparator = DEFAULT_SEPARATOR,
|
|
73
|
+
} = interpolation;
|
|
74
|
+
const regex = new RegExp(`${prefix}[\\w\\.\\-${formatSeparator}\\s]+${suffix}`, 'g');
|
|
75
|
+
const matches = value.match(regex);
|
|
76
|
+
if (!matches) return value;
|
|
77
|
+
const prefixRegExp = new RegExp(`^${prefix}`);
|
|
78
|
+
const suffixRegExp = new RegExp(`${suffix}$`);
|
|
79
|
+
let interpolatedValue = value;
|
|
80
|
+
forEach(matches, (match) => {
|
|
81
|
+
const keyName = match.replace(prefixRegExp, '').replace(suffixRegExp, '');
|
|
82
|
+
interpolatedValue = interpolateMatch(interpolatedValue, keyName, match, options);
|
|
83
|
+
});
|
|
84
|
+
return interpolatedValue;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const Interpolation: MiddlewareSetup = () => ({
|
|
88
|
+
valueModifying: [
|
|
89
|
+
{
|
|
90
|
+
priority: 4,
|
|
91
|
+
name: 'interpolation-name-modifier',
|
|
92
|
+
middleware: interpolate,
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Interpolation } from './Interpolation';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { forEach } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
2
|
+
import { i18n } from '../../../I18n';
|
|
3
|
+
import { publicOptionsOnly } from '../../../utils';
|
|
4
|
+
import {
|
|
5
|
+
MiddlewareSetup,
|
|
6
|
+
PrivateTranslationOptions,
|
|
7
|
+
ValueModifyingMiddleware,
|
|
8
|
+
} from '../../../types';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Matches $t(any word character . or :)
|
|
12
|
+
*/
|
|
13
|
+
// eslint-disable-next-line no-useless-escape
|
|
14
|
+
const NESTED_REGEX = /\$t\([\w\.:]+\)/g;
|
|
15
|
+
|
|
16
|
+
const findNested: ValueModifyingMiddleware['middleware'] = (
|
|
17
|
+
value: string, options: PrivateTranslationOptions,
|
|
18
|
+
): string => {
|
|
19
|
+
const matches = value.match(NESTED_REGEX);
|
|
20
|
+
if (!matches) return value;
|
|
21
|
+
let modifiedValue = value;
|
|
22
|
+
forEach(matches, (match) => {
|
|
23
|
+
const key = match.replace(/^\$t\(/, '').replace(/\)$/, '');
|
|
24
|
+
const translation = i18n.t(key, publicOptionsOnly(options));
|
|
25
|
+
modifiedValue = modifiedValue.replace(match, translation);
|
|
26
|
+
});
|
|
27
|
+
return modifiedValue;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Nesting: MiddlewareSetup = () => ({
|
|
31
|
+
valueModifying: [
|
|
32
|
+
{
|
|
33
|
+
priority: 2,
|
|
34
|
+
name: 'nesting-value-modifier',
|
|
35
|
+
middleware: findNested,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Nesting } from './Nesting';
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { forEach } from '@24i/bigscreen-sdk/perf-utils/array';
|
|
2
|
+
import * as resolvers from './Resolvers';
|
|
3
|
+
import { PluralsHelper } from '../../../pluralsCommon/PluralsHelper';
|
|
4
|
+
import { resolverByLanguage } from '../../../pluralsCommon/ResolverByLanguage';
|
|
5
|
+
import type { PluralFormResolver } from './types';
|
|
6
|
+
import type {
|
|
7
|
+
KeyModifyingMiddleware,
|
|
8
|
+
MiddlewareSetup,
|
|
9
|
+
PrivateTranslationOptions,
|
|
10
|
+
Translation,
|
|
11
|
+
ValueModifyingMiddleware,
|
|
12
|
+
} from '../../../types';
|
|
13
|
+
|
|
14
|
+
const RESOLVER_BY_LANGUAGE = resolverByLanguage<PluralFormResolver>(resolvers);
|
|
15
|
+
const plurals = new PluralsHelper<PluralFormResolver>(RESOLVER_BY_LANGUAGE);
|
|
16
|
+
|
|
17
|
+
const keyExists = (key: string, namespace: Record<string, Translation>) => (
|
|
18
|
+
typeof namespace[key] !== 'undefined'
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const getIntervalKey = (key: string) => `${key}_interval`;
|
|
22
|
+
const getPluralFormKey = (key: string, form: number) => `${key}_${form}`;
|
|
23
|
+
const getPluralKey = (key: string) => `${key}_plural`;
|
|
24
|
+
|
|
25
|
+
/* eslint-disable no-useless-escape */
|
|
26
|
+
/**
|
|
27
|
+
* Matches {anything} or {anything{{anything}}anything}
|
|
28
|
+
*/
|
|
29
|
+
const INTERVAL_VALUE_REGEX = /\{((.*?{{.+?(?=}})\}\}.*)|(.+?(?=})))\}/g;
|
|
30
|
+
/**
|
|
31
|
+
* Matches (number) or (number-number) or (number-inf)
|
|
32
|
+
* and {anything} or {anything{{anything}}anything}
|
|
33
|
+
* and ;
|
|
34
|
+
*/
|
|
35
|
+
const INTERVAL_REGEX = /\((\d+|(\d+\-(\d+|inf)))\)\{((.+?(?=}))|(.*?{{.+?(?=}})\}\}.*))\};/g;
|
|
36
|
+
/**
|
|
37
|
+
* Matches (number) or (number-number) or (number-inf)
|
|
38
|
+
*/
|
|
39
|
+
const NUMBERS_IN_INTERVAL_REGEX = /\((\d+|(\d+\-(\d+|inf)))\)/g;
|
|
40
|
+
/* eslint-disable no-useless-escape */
|
|
41
|
+
|
|
42
|
+
const isCountInInterval = (count: number, interval: string) => {
|
|
43
|
+
const numbers = interval.match(NUMBERS_IN_INTERVAL_REGEX)![0]
|
|
44
|
+
.replace(/^\(/, '').replace(/\)$/, '').split('-');
|
|
45
|
+
if (numbers.length === 1 && parseInt(numbers[0], 10) === count) return true;
|
|
46
|
+
const from = parseInt(numbers[0], 10);
|
|
47
|
+
const to = numbers[1] === 'inf' ? Infinity : parseInt(numbers[1], 10);
|
|
48
|
+
if (count >= from && count <= to) return true;
|
|
49
|
+
return false;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const shouldUseInterval = (
|
|
53
|
+
intervalKey: string,
|
|
54
|
+
namespace: Record<string, Translation>,
|
|
55
|
+
count: number,
|
|
56
|
+
) => {
|
|
57
|
+
if (!keyExists(intervalKey, namespace)) return false;
|
|
58
|
+
const value = namespace[intervalKey];
|
|
59
|
+
if (typeof value !== 'string') return false;
|
|
60
|
+
const matches = value.match(INTERVAL_REGEX);
|
|
61
|
+
if (!matches) return false;
|
|
62
|
+
const matchesLength = matches.length;
|
|
63
|
+
for (let i = 0; i < matchesLength; i++) {
|
|
64
|
+
if (isCountInInterval(count, matches[i])) return true;
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const pluralsKeyModifier: KeyModifyingMiddleware['middleware'] = (
|
|
70
|
+
key: string,
|
|
71
|
+
namespace: Record<string, Translation>,
|
|
72
|
+
options: PrivateTranslationOptions,
|
|
73
|
+
): string => {
|
|
74
|
+
const { count } = options;
|
|
75
|
+
if (typeof count !== 'number') return key;
|
|
76
|
+
const intervalKey = getIntervalKey(key);
|
|
77
|
+
if (shouldUseInterval(intervalKey, namespace, count)) {
|
|
78
|
+
options.useInterval = true;
|
|
79
|
+
return intervalKey;
|
|
80
|
+
}
|
|
81
|
+
const form = plurals.resolveForm(count);
|
|
82
|
+
const exactKey = getPluralFormKey(key, form);
|
|
83
|
+
if (keyExists(exactKey, namespace)) return exactKey;
|
|
84
|
+
const vagueKey = count === 1 ? key : getPluralKey(key);
|
|
85
|
+
if (keyExists(vagueKey, namespace)) return vagueKey;
|
|
86
|
+
return key;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const pluralsValueModifier: ValueModifyingMiddleware['middleware'] = (
|
|
90
|
+
value: string, { count, useInterval }: PrivateTranslationOptions,
|
|
91
|
+
) => {
|
|
92
|
+
if (!useInterval) return value;
|
|
93
|
+
const intervalMatches = value.match(INTERVAL_REGEX);
|
|
94
|
+
if (!intervalMatches) return value;
|
|
95
|
+
let modifiedValue = value;
|
|
96
|
+
forEach(intervalMatches, (interval) => {
|
|
97
|
+
if (isCountInInterval(count, interval)) {
|
|
98
|
+
const intervalValue = interval.match(INTERVAL_VALUE_REGEX)![0]
|
|
99
|
+
.replace(/^\{/, '').replace(/\}$/, '');
|
|
100
|
+
modifiedValue = modifiedValue.replace(interval, intervalValue);
|
|
101
|
+
} else {
|
|
102
|
+
modifiedValue = modifiedValue.replace(interval, '');
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
return modifiedValue;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const Plurals: MiddlewareSetup = () => ({
|
|
109
|
+
keyModifying: [
|
|
110
|
+
{
|
|
111
|
+
priority: 3,
|
|
112
|
+
name: 'plurals-key-modifier',
|
|
113
|
+
middleware: pluralsKeyModifier,
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
valueModifying: [
|
|
117
|
+
{
|
|
118
|
+
priority: 3,
|
|
119
|
+
name: 'plurals-value-modifier',
|
|
120
|
+
middleware: pluralsValueModifier,
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
});
|