@salesforcedevs/dx-components 0.16.3 → 0.17.1-review-diff1
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/lwc.config.json +85 -26
- package/package.json +34 -19
- package/src/assets/icons/brand-sprite/svg/symbols.svg +23 -5
- package/src/assets/icons/salesforcebrand-sprite/svg/symbols.svg +909 -107
- package/src/assets/icons/utility-sprite/svg/symbols.svg +2 -1
- package/src/modules/dx/agenda/agenda.css +97 -0
- package/src/modules/dx/agenda/agenda.html +32 -0
- package/src/modules/dx/agenda/agenda.ts +26 -0
- package/src/modules/dx/alert/alert.css +103 -0
- package/src/modules/dx/alert/alert.html +37 -0
- package/src/modules/dx/alert/alert.ts +137 -0
- package/src/modules/dx/audio/audio.css +276 -0
- package/src/modules/dx/audio/audio.html +158 -0
- package/src/modules/dx/audio/audio.ts +484 -0
- package/src/modules/dx/banner/banner.css +3 -3
- package/src/modules/dx/banner/banner.ts +3 -5
- package/src/modules/dx/brandThemeProvider/brandThemeProvider.ts +1 -1
- package/src/modules/dx/breadcrumbs/breadcrumbs.css +4 -4
- package/src/modules/dx/breadcrumbs/breadcrumbs.html +1 -1
- package/src/modules/dx/breadcrumbs/breadcrumbs.ts +28 -27
- package/src/modules/dx/button/button.css +79 -25
- package/src/modules/dx/button/button.html +4 -2
- package/src/modules/dx/button/button.ts +41 -14
- package/src/modules/dx/buttonToggle/buttonToggle.css +50 -0
- package/src/modules/dx/buttonToggle/buttonToggle.html +17 -0
- package/src/modules/dx/buttonToggle/buttonToggle.ts +75 -0
- package/src/modules/dx/cardBlogPost/cardBlogPost.css +2 -2
- package/src/modules/dx/cardBlogPost/cardBlogPost.html +5 -4
- package/src/modules/dx/cardBlogPost/cardBlogPost.ts +27 -4
- package/src/modules/dx/cardCallout/cardCallout.css +5 -5
- package/src/modules/dx/cardCallout/cardCallout.html +1 -1
- package/src/modules/dx/cardCallout/cardCallout.ts +14 -10
- package/src/modules/dx/cardClickthrough/cardClickthrough.css +105 -0
- package/src/modules/dx/cardClickthrough/cardClickthrough.html +42 -0
- package/src/modules/dx/cardClickthrough/cardClickthrough.ts +139 -0
- package/src/modules/dx/cardContent/cardContent.css +21 -9
- package/src/modules/dx/cardContent/cardContent.html +33 -14
- package/src/modules/dx/cardContent/cardContent.ts +80 -15
- package/src/modules/dx/cardDemo/cardDemo.css +1 -1
- package/src/modules/dx/cardDemo/cardDemo.html +1 -1
- package/src/modules/dx/cardDemo/cardDemo.ts +1 -1
- package/src/modules/dx/cardDocs/cardDocs.css +8 -8
- package/src/modules/dx/cardDocs/cardDocs.html +25 -5
- package/src/modules/dx/cardDocs/cardDocs.ts +51 -2
- package/src/modules/dx/cardEvent/cardEvent.css +31 -17
- package/src/modules/dx/cardEvent/cardEvent.html +17 -18
- package/src/modules/dx/cardEvent/cardEvent.ts +11 -3
- package/src/modules/dx/cardExpanded/cardExpanded.css +60 -0
- package/src/modules/dx/cardExpanded/cardExpanded.html +35 -0
- package/src/modules/dx/cardExpanded/cardExpanded.ts +63 -0
- package/src/modules/dx/cardGrid/cardGrid.css +1 -85
- package/src/modules/dx/cardGrid/cardGrid.html +16 -44
- package/src/modules/dx/cardGrid/cardGrid.ts +32 -139
- package/src/modules/dx/cardGridDocs/cardGridDocs.css +73 -0
- package/src/modules/dx/cardGridDocs/cardGridDocs.html +67 -0
- package/src/modules/dx/cardGridDocs/cardGridDocs.ts +86 -0
- package/src/modules/dx/cardMinimal/cardMinimal.css +31 -0
- package/src/modules/dx/cardMinimal/cardMinimal.html +8 -0
- package/src/modules/dx/cardMinimal/cardMinimal.ts +3 -0
- package/src/modules/dx/cardNews/cardNews.css +34 -15
- package/src/modules/dx/cardNews/cardNews.html +8 -1
- package/src/modules/dx/cardNews/cardNews.ts +23 -5
- package/src/modules/dx/cardPodcastEpisode/cardPodcastEpisode.css +3 -3
- package/src/modules/dx/cardPodcastEpisode/cardPodcastEpisode.html +2 -1
- package/src/modules/dx/cardPodcastEpisode/cardPodcastEpisode.ts +1 -1
- package/src/modules/dx/cardSmall/cardSmall.css +3 -7
- package/src/modules/dx/cardSmall/cardSmall.html +2 -2
- package/src/modules/dx/cardSmall/cardSmall.ts +2 -2
- package/src/modules/dx/cardStep/cardStep.css +128 -0
- package/src/modules/dx/cardStep/cardStep.html +31 -0
- package/src/modules/dx/cardStep/cardStep.ts +55 -0
- package/src/modules/dx/cardStep/mockProps.ts +59 -0
- package/src/modules/dx/cardTestimonial/cardTestimonial.css +24 -0
- package/src/modules/dx/cardTestimonial/cardTestimonial.html +15 -0
- package/src/modules/dx/cardTestimonial/cardTestimonial.ts +18 -0
- package/src/modules/dx/cardTitle/cardTitle.css +6 -4
- package/src/modules/dx/cardTitle/cardTitle.html +1 -1
- package/src/modules/dx/cardTitle/cardTitle.ts +4 -4
- package/src/modules/dx/cardTrailheadModule/cardTrailheadModule.css +2 -2
- package/src/modules/dx/cardTrailheadModule/cardTrailheadModule.html +2 -2
- package/src/modules/dx/cardTrailheadModule/cardTrailheadModule.ts +2 -1
- package/src/modules/dx/cardTrial/cardTrial.css +134 -0
- package/src/modules/dx/cardTrial/cardTrial.html +207 -0
- package/src/modules/dx/cardTrial/cardTrial.ts +147 -0
- package/src/modules/dx/cardTrialExpanded/cardTrialExpanded.css +159 -0
- package/src/modules/dx/cardTrialExpanded/cardTrialExpanded.html +91 -0
- package/src/modules/dx/cardTrialExpanded/cardTrialExpanded.ts +84 -0
- package/src/modules/dx/cardVideoPreview/cardVideoPreview.css +2 -2
- package/src/modules/dx/cardVideoPreview/cardVideoPreview.html +3 -2
- package/src/modules/dx/cardVideoPreview/cardVideoPreview.ts +2 -2
- package/src/modules/dx/checkbox/checkbox.css +9 -4
- package/src/modules/dx/checkbox/checkbox.ts +27 -2
- package/src/modules/dx/checkboxGroup/checkboxGroup.css +1 -1
- package/src/modules/dx/checkboxGroup/checkboxGroup.ts +1 -1
- package/src/modules/dx/checkboxNative/checkboxNative.css +18 -0
- package/src/modules/dx/checkboxNative/checkboxNative.html +14 -0
- package/src/modules/dx/checkboxNative/checkboxNative.ts +39 -0
- package/src/modules/dx/codeBlock/codeBlock.css +22 -15
- package/src/modules/dx/codeBlock/codeBlock.html +3 -3
- package/src/modules/dx/codeBlock/codeBlock.ts +149 -61
- package/src/modules/dx/codeBlock/customLanguages.js +48 -0
- package/src/modules/dx/codeBlock/darkAndLightThemes.css +177 -0
- package/src/modules/dx/coveoRecommendations/coveoRecommendations.css +8 -0
- package/src/modules/dx/coveoRecommendations/coveoRecommendations.html +27 -0
- package/src/modules/dx/coveoRecommendations/coveoRecommendations.ts +171 -0
- package/src/modules/dx/darkModeManager/darkModeManager.ts +86 -0
- package/src/modules/dx/dropdown/dropdown.css +3 -5
- package/src/modules/dx/dropdown/dropdown.html +7 -1
- package/src/modules/dx/dropdown/dropdown.ts +18 -9
- package/src/modules/dx/dropdownOption/dropdownOption.css +125 -5
- package/src/modules/dx/dropdownOption/dropdownOption.html +7 -2
- package/src/modules/dx/dropdownOption/dropdownOption.ts +27 -9
- package/src/modules/dx/embeddedVideo/embeddedVideo.css +35 -0
- package/src/modules/dx/embeddedVideo/embeddedVideo.html +56 -0
- package/src/modules/dx/embeddedVideo/embeddedVideo.ts +40 -0
- package/src/modules/dx/emptyState/emptyState.css +76 -4
- package/src/modules/dx/emptyState/emptyState.html +16 -4
- package/src/modules/dx/emptyState/emptyState.ts +57 -7
- package/src/modules/dx/errorFallback/errorFallback.css +27 -0
- package/src/modules/dx/errorFallback/errorFallback.html +11 -0
- package/src/modules/dx/errorFallback/errorFallback.ts +7 -0
- package/src/modules/dx/eyebrow/eyebrow.css +44 -0
- package/src/modules/dx/eyebrow/eyebrow.html +16 -0
- package/src/modules/dx/eyebrow/eyebrow.ts +32 -0
- package/src/modules/dx/faq/faq.css +58 -0
- package/src/modules/dx/faq/faq.html +36 -0
- package/src/modules/dx/faq/faq.ts +16 -0
- package/src/modules/dx/feature/feature.css +16 -6
- package/src/modules/dx/feature/feature.html +9 -7
- package/src/modules/dx/feature/feature.ts +17 -4
- package/src/modules/dx/featureFlag/featureFlag.css +3 -0
- package/src/modules/dx/featureFlag/featureFlag.html +3 -0
- package/src/modules/dx/featureFlag/featureFlag.ts +41 -0
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.css +182 -146
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.html +123 -87
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.ts +179 -30
- package/src/modules/dx/featuredContentHeader/svgs.ts +5 -4
- package/src/modules/dx/featuresList/featuresList.css +5 -5
- package/src/modules/dx/featuresList/featuresList.html +2 -2
- package/src/modules/dx/featuresList/featuresList.ts +2 -3
- package/src/modules/dx/featuresListHeader/featuresListHeader.css +144 -0
- package/src/modules/dx/featuresListHeader/featuresListHeader.html +58 -0
- package/src/modules/dx/featuresListHeader/featuresListHeader.ts +103 -0
- package/src/modules/dx/filterMenu/filterMenu.css +134 -0
- package/src/modules/dx/filterMenu/filterMenu.html +111 -0
- package/src/modules/dx/filterMenu/filterMenu.ts +119 -0
- package/src/modules/dx/footer/footer.css +72 -41
- package/src/modules/dx/footer/footer.html +65 -65
- package/src/modules/dx/footer/footer.ts +66 -31
- package/src/modules/dx/footer/links.ts +142 -54
- package/src/modules/dx/footerOption/footerOption.css +10 -3
- package/src/modules/dx/footerOption/footerOption.html +1 -10
- package/src/modules/dx/footerOption/footerOption.ts +21 -7
- package/src/modules/dx/formattedDateTime/formattedDateTime.ts +22 -14
- package/src/modules/dx/formattedRichText/formattedRichText.css +32 -0
- package/src/modules/dx/formattedRichText/formattedRichText.html +3 -0
- package/src/modules/dx/formattedRichText/formattedRichText.ts +17 -0
- package/src/modules/dx/grid/grid.css +7 -2
- package/src/modules/dx/grid/grid.html +15 -0
- package/src/modules/dx/grid/grid.ts +78 -2
- package/src/modules/dx/groupText/groupText.css +5 -9
- package/src/modules/dx/groupText/groupText.html +8 -3
- package/src/modules/dx/groupText/groupText.ts +21 -14
- package/src/modules/dx/headerMobileNavMenu/headerMobileNavMenu.css +3 -2
- package/src/modules/dx/headerMobileNavMenu/headerMobileNavMenu.ts +5 -5
- package/src/modules/dx/headerMobileNavMenuOption/headerMobileNavMenuOption.ts +10 -2
- package/src/modules/dx/headerNav/headerNav.css +9 -1
- package/src/modules/dx/headerNav/headerNav.html +2 -0
- package/src/modules/dx/headerNav/headerNav.ts +10 -6
- package/src/modules/dx/helmet/helmet.css +3 -3
- package/src/modules/dx/helmet/helmet.html +2 -2
- package/src/modules/dx/helmet/helmet.ts +2 -2
- package/src/modules/dx/hr/hr.css +10 -10
- package/src/modules/dx/hr/hr.ts +7 -1
- package/src/modules/dx/icon/icon.css +2 -2
- package/src/modules/dx/icon/icon.html +20 -9
- package/src/modules/dx/icon/icon.ts +6 -1
- package/src/modules/dx/iconBadge/iconBadge.css +13 -1
- package/src/modules/dx/iconBadge/iconBadge.html +3 -3
- package/src/modules/dx/iconBadge/iconBadge.ts +23 -7
- package/src/modules/dx/imageAndLabel/imageAndLabel.css +4 -8
- package/src/modules/dx/imageAndLabel/imageAndLabel.html +18 -2
- package/src/modules/dx/input/input.css +24 -6
- package/src/modules/dx/input/input.html +6 -1
- package/src/modules/dx/input/input.ts +76 -10
- package/src/modules/dx/interactiveImage/interactiveImage.css +2 -2
- package/src/modules/dx/interactiveImage/interactiveImage.html +2 -2
- package/src/modules/dx/interactiveImage/interactiveImage.ts +2 -2
- package/src/modules/dx/logo/logo.css +2 -3
- package/src/modules/dx/logo/logo.html +1 -1
- package/src/modules/dx/logo/logo.ts +3 -2
- package/src/modules/dx/mainContentHeader/mainContentHeader.css +197 -0
- package/src/modules/dx/mainContentHeader/mainContentHeader.html +75 -0
- package/src/modules/dx/mainContentHeader/mainContentHeader.ts +98 -0
- package/src/modules/dx/metadataBadge/metadataBadge.css +41 -0
- package/src/modules/dx/metadataBadge/metadataBadge.html +5 -0
- package/src/modules/dx/metadataBadge/metadataBadge.ts +24 -0
- package/src/modules/dx/modal/modal.css +7 -0
- package/src/modules/dx/modal/modal.html +13 -0
- package/src/modules/dx/modal/modal.ts +98 -0
- package/src/modules/dx/modalDrawer/modalDrawer.css +41 -0
- package/src/modules/dx/modalDrawer/modalDrawer.html +11 -0
- package/src/modules/dx/modalDrawer/modalDrawer.ts +33 -0
- package/src/modules/dx/pagination/pagination.css +2 -3
- package/src/modules/dx/pagination/pagination.ts +45 -8
- package/src/modules/dx/podcastHost/podcastHost.css +11 -4
- package/src/modules/dx/podcastHost/podcastHost.html +8 -9
- package/src/modules/dx/popover/popover.css +31 -6
- package/src/modules/dx/popover/popover.html +1 -1
- package/src/modules/dx/popover/popover.ts +112 -47
- package/src/modules/dx/radioGroup/radioGroup.css +1 -1
- package/src/modules/dx/radioGroup/radioGroup.ts +1 -1
- package/src/modules/dx/redirectChecker/redirectChecker.html +1 -0
- package/src/modules/dx/redirectChecker/redirectChecker.ts +10 -0
- package/src/modules/dx/relativeDateTime/relativeDateTime.ts +23 -94
- package/src/modules/dx/scrollManager/scrollManager.html +1 -0
- package/src/modules/dx/scrollManager/scrollManager.ts +212 -0
- package/src/modules/dx/searchResults/coveo.css +2138 -3126
- package/src/modules/dx/searchResults/resultsTemplate.js +141 -0
- package/src/modules/dx/searchResults/searchResults.css +136 -19
- package/src/modules/dx/searchResults/searchResults.html +7 -4
- package/src/modules/dx/searchResults/searchResults.ts +378 -37
- package/src/modules/dx/section/section.css +40 -7
- package/src/modules/dx/section/section.html +37 -7
- package/src/modules/dx/section/section.ts +45 -13
- package/src/modules/dx/sectionBanner/sectionBanner.css +145 -0
- package/src/modules/dx/sectionBanner/sectionBanner.html +41 -0
- package/src/modules/dx/sectionBanner/sectionBanner.ts +128 -0
- package/src/modules/dx/sectionSignup/sectionSignup.ts +2 -2
- package/src/modules/dx/select/select.css +173 -10
- package/src/modules/dx/select/select.html +54 -53
- package/src/modules/dx/select/select.ts +153 -10
- package/src/modules/dx/sidebar/sidebar.css +44 -130
- package/src/modules/dx/sidebar/sidebar.html +114 -50
- package/src/modules/dx/sidebar/sidebar.ts +159 -116
- package/src/modules/dx/sidebarFooterNav/sidebarFooterNav.css +49 -0
- package/src/modules/dx/sidebarFooterNav/sidebarFooterNav.html +55 -0
- package/src/modules/dx/sidebarFooterNav/sidebarFooterNav.ts +106 -0
- package/src/modules/dx/sidebarOld/sidebarOld.css +33 -0
- package/src/modules/dx/sidebarOld/sidebarOld.html +111 -0
- package/src/modules/dx/sidebarOld/sidebarOld.ts +170 -0
- package/src/modules/dx/sidebarSearch/sidebarSearch.css +3 -0
- package/src/modules/dx/sidebarSearch/sidebarSearch.html +25 -0
- package/src/modules/dx/sidebarSearch/sidebarSearch.ts +493 -0
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.css +67 -0
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.html +20 -0
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.ts +78 -0
- package/src/modules/dx/skipNavLink/skipNavLink.css +21 -0
- package/src/modules/dx/skipNavLink/skipNavLink.html +3 -0
- package/src/modules/dx/skipNavLink/skipNavLink.ts +3 -0
- package/src/modules/dx/socials/socials.css +4 -3
- package/src/modules/dx/socials/socials.ts +1 -6
- package/src/modules/dx/spinner/spinner.css +28 -232
- package/src/modules/dx/stepSequence/stepSequence.css +42 -0
- package/src/modules/dx/stepSequence/stepSequence.html +10 -0
- package/src/modules/dx/stepSequence/stepSequence.ts +334 -0
- package/src/modules/dx/stepSequenceStep/stepSequenceStep.html +3 -0
- package/src/modules/dx/stepSequenceStep/stepSequenceStep.ts +60 -0
- package/src/modules/dx/tab/tab.css +49 -24
- package/src/modules/dx/tab/tab.ts +16 -5
- package/src/modules/dx/tabPanel/tabPanel.css +20 -0
- package/src/modules/dx/tabPanel/tabPanel.html +13 -0
- package/src/modules/dx/tabPanel/tabPanel.ts +27 -0
- package/src/modules/dx/tabPanelItem/tabPanelItem.css +54 -0
- package/src/modules/dx/tabPanelItem/tabPanelItem.html +26 -0
- package/src/modules/dx/tabPanelItem/tabPanelItem.ts +45 -0
- package/src/modules/dx/tabPanelList/tabPanelList.css +37 -0
- package/src/modules/dx/tabPanelList/tabPanelList.html +56 -0
- package/src/modules/dx/tabPanelList/tabPanelList.ts +178 -0
- package/src/modules/dx/tabPanelList/uniqueId.ts +6 -0
- package/src/modules/dx/tabbedCodeBlock/tabbedCodeBlock.css +8 -0
- package/src/modules/dx/tabbedCodeBlock/tabbedCodeBlock.html +16 -0
- package/src/modules/dx/tabbedCodeBlock/tabbedCodeBlock.ts +44 -0
- package/src/modules/dx/tbidAvatarButton/tbidAvatarButton.css +33 -0
- package/src/modules/dx/tbidAvatarButton/tbidAvatarButton.html +53 -0
- package/src/modules/dx/tbidAvatarButton/tbidAvatarButton.ts +450 -0
- package/src/modules/dx/toast/toast.css +78 -0
- package/src/modules/dx/toast/toast.html +20 -0
- package/src/modules/dx/toast/toast.ts +41 -0
- package/src/modules/dx/toc/toc.css +18 -46
- package/src/modules/dx/toc/toc.html +5 -11
- package/src/modules/dx/toc/toc.ts +20 -31
- package/src/modules/dx/tooltip/tooltip.css +1 -0
- package/src/modules/dx/topics/topics.css +26 -0
- package/src/modules/dx/topics/topics.html +12 -0
- package/src/modules/dx/topics/topics.ts +25 -0
- package/src/modules/dx/trafficLabeler/trafficLabeler.html +1 -0
- package/src/modules/dx/trafficLabeler/trafficLabeler.ts +58 -0
- package/src/modules/dx/tree/tree.css +1 -1
- package/src/modules/dx/tree/tree.ts +9 -1
- package/src/modules/dx/tree/treeHandler.ts +5 -1
- package/src/modules/dx/treeItem/treeItem.css +12 -1
- package/src/modules/dx/treeItem/treeItem.html +10 -2
- package/src/modules/dx/treeItem/treeItem.ts +103 -15
- package/src/modules/dx/treeTile/treeTile.css +77 -64
- package/src/modules/dx/treeTile/treeTile.html +24 -10
- package/src/modules/dx/treeTile/treeTile.ts +31 -6
- package/src/modules/dx/typeBadge/typeBadge.css +2 -59
- package/src/modules/dx/typeBadge/typeBadge.html +7 -1
- package/src/modules/dx/typeBadge/typeBadge.ts +97 -8
- package/src/modules/dx/vimeoPlayer/vimeoPlayer.css +1 -0
- package/src/modules/dx/vimeoPlayer/vimeoPlayer.html +3 -0
- package/src/modules/dx/vimeoPlayer/vimeoPlayer.ts +31 -0
- package/src/modules/dxBaseElements/archiveCard/archiveCard.ts +31 -0
- package/src/modules/{utils → dxBaseElements}/headerBase/headerBase.ts +37 -13
- package/src/modules/dxBaseElements/lightningElementWithState/lightningElementWithState.ts +93 -0
- package/src/modules/dxBaseElements/matchMediaElement/matchMediaElement.ts +63 -0
- package/src/modules/dxBaseElements/sidebarBase/sidebarBase.ts +176 -0
- package/src/modules/dxConstants/brands/brands.ts +18 -0
- package/src/modules/dxConstants/colors/colors.ts +14 -0
- package/src/modules/dxConstants/contentTypes/contentTypes.ts +72 -0
- package/src/modules/{helpers → dxHelpers}/animations/animations.css +1 -1
- package/src/modules/dxHelpers/button/button.css +4 -0
- package/src/modules/{helpers → dxHelpers}/card/card.css +33 -32
- package/src/modules/{helpers → dxHelpers}/code/code.css +5 -13
- package/src/modules/{helpers → dxHelpers}/commonHeader/commonHeader.css +13 -11
- package/src/modules/dxHelpers/commonSidebar/commonSidebar.css +179 -0
- package/src/modules/dxHelpers/commonTreeItem/commonTreeItem.css +44 -0
- package/src/modules/{helpers → dxHelpers}/reset/reset.css +6 -13
- package/src/modules/dxHelpers/scrollbar/scrollbar.css +31 -0
- package/src/modules/{helpers → dxHelpers}/table/table.css +2 -6
- package/src/modules/{helpers → dxHelpers}/text/text.css +71 -32
- package/src/modules/dxHelpers/typeBadge/typeBadge.css +32 -0
- package/src/modules/dxUtils/analytics/analytics.ts +24 -0
- package/src/modules/dxUtils/async/async.ts +45 -0
- package/src/modules/dxUtils/browser/browser.ts +17 -0
- package/src/modules/dxUtils/constants/breakpoints.ts +9 -0
- package/src/modules/dxUtils/constants/constants.ts +1 -0
- package/src/modules/dxUtils/contentTypes/contentTypes.ts +30 -0
- package/src/modules/dxUtils/coveo/coveo.ts +70 -0
- package/src/modules/dxUtils/css/css.ts +58 -0
- package/src/modules/dxUtils/dates/dates.ts +72 -0
- package/src/modules/{utils → dxUtils}/highlight/highlight.ts +3 -2
- package/src/modules/dxUtils/language/language.ts +21 -0
- package/src/modules/dxUtils/list/list.ts +11 -0
- package/src/modules/dxUtils/lwc/lwc.ts +24 -0
- package/src/modules/dxUtils/normalizers/normalizers.ts +112 -0
- package/src/modules/{utils → dxUtils}/options/options.ts +13 -9
- package/src/modules/dxUtils/prismjs/prismjs.ts +4183 -0
- package/src/modules/dxUtils/queryCoordinator/queryCoordinator.ts +43 -0
- package/src/modules/dxUtils/recentSearches/recentSearches.ts +57 -0
- package/src/modules/dxUtils/sanitizeHtml/sanitizeHtml.ts +8 -0
- package/src/modules/dxUtils/urlWatcher/urlWatcher.ts +79 -0
- package/src/modules/dxUtils/withTypedRefs/withTypedRefs.ts +26 -0
- package/src/modules/{utils → dxUtils}/wordpress/wordpress.ts +14 -0
- package/LICENSE +0 -12
- package/src/assets/svg/card-news-learn-moar.svg +0 -415
- package/src/assets/svg/cloud-1.svg +0 -24
- package/src/assets/svg/cloud-2.svg +0 -18
- package/src/assets/svg/codey.svg +0 -93
- package/src/assets/svg/command.svg +0 -9
- package/src/assets/svg/control.svg +0 -10
- package/src/assets/svg/docs-empty-state-small.svg +0 -72
- package/src/assets/svg/docs-empty-state.svg +0 -86
- package/src/assets/svg/dsc-home-news-bear.svg +0 -3
- package/src/assets/svg/dsc-home-news-community.png +0 -0
- package/src/assets/svg/dsc-home-news-goatbear.svg +0 -257
- package/src/assets/svg/dsc-home-news-samplegallery.svg +0 -76
- package/src/assets/svg/empty-state-assistant.svg +0 -1
- package/src/assets/svg/fch-blog-cloud-1.png +0 -0
- package/src/assets/svg/fch-blog-cloud-2.png +0 -0
- package/src/assets/svg/fch-blog-planet.png +0 -0
- package/src/assets/svg/feature-backdrop1.svg +0 -10
- package/src/assets/svg/feature-backdrop2.svg +0 -10
- package/src/assets/svg/featured-demo-art-blank.svg +0 -76
- package/src/assets/svg/featured-demo-art-eBikes.svg +0 -77
- package/src/assets/svg/footer-graphic-large.svg +0 -207
- package/src/assets/svg/footer-graphic-mountains-small.svg +0 -17
- package/src/assets/svg/footer-graphic-mountains.svg +0 -21
- package/src/assets/svg/footer-graphic-trees-small.svg +0 -33
- package/src/assets/svg/footer-graphic-trees.svg +0 -62
- package/src/assets/svg/lake-mountain.svg +0 -79
- package/src/assets/svg/podcast-subscription-clouds-small.svg +0 -49
- package/src/assets/svg/podcast-subscription-clouds.svg +0 -57
- package/src/assets/svg/podcasts-subscription-apple.svg +0 -164
- package/src/assets/svg/podcasts-subscription-google.svg +0 -29
- package/src/assets/svg/podcasts-subscription-spotify.svg +0 -11
- package/src/assets/svg/salesforce-cloud.svg +0 -7
- package/src/assets/svg/salesforce-logo-corporate.svg +0 -21
- package/src/assets/svg/salesforce-logo.svg +0 -14
- package/src/assets/svg/trees.svg +0 -42
- package/src/modules/dx/banner/__tests__/banner.test.ts +0 -31
- package/src/modules/dx/brandThemeProvider/__tests__/brandThemeProvider.test.ts +0 -49
- package/src/modules/dx/brandThemeProvider/brandThemeProvider.stories.ts +0 -321
- package/src/modules/dx/breadcrumbs/__tests__/breadcrumbs.test.ts +0 -143
- package/src/modules/dx/breadcrumbs/__tests__/mockProps.ts +0 -28
- package/src/modules/dx/breadcrumbs/breadcrumbs.stories.ts +0 -39
- package/src/modules/dx/button/__tests__/button.test.ts +0 -107
- package/src/modules/dx/button/button.stories.ts +0 -150
- package/src/modules/dx/cardBlogPost/__tests__/cardBlogPost.test.ts +0 -27
- package/src/modules/dx/cardBlogPost/__tests__/mockProps.ts +0 -12
- package/src/modules/dx/cardBlogPost/cardBlogPost.stories.ts +0 -164
- package/src/modules/dx/cardBlogPostProvider/__tests__/cardBlogPostProvider.test.ts +0 -34
- package/src/modules/dx/cardBlogPostProvider/__tests__/mockWordpressPosts.ts +0 -44
- package/src/modules/dx/cardBlogPostProvider/cardBlogPostProvider.css +0 -3
- package/src/modules/dx/cardBlogPostProvider/cardBlogPostProvider.html +0 -16
- package/src/modules/dx/cardBlogPostProvider/cardBlogPostProvider.ts +0 -29
- package/src/modules/dx/cardCallout/__tests__/cardCallout.test.ts +0 -23
- package/src/modules/dx/cardCallout/__tests__/mockProps.ts +0 -7
- package/src/modules/dx/cardCallout/cardCallout.stories.ts +0 -33
- package/src/modules/dx/cardContent/__tests__/cardContent.test.ts +0 -112
- package/src/modules/dx/cardContent/__tests__/mockProps.ts +0 -13
- package/src/modules/dx/cardContent/cardContent.stories.ts +0 -127
- package/src/modules/dx/cardDemo/cardDemo.stories.ts +0 -115
- package/src/modules/dx/cardDocs/__tests__/cardDocs.test.ts +0 -48
- package/src/modules/dx/cardDocs/__tests__/mockProps.ts +0 -9
- package/src/modules/dx/cardDocs/cardDocs.stories.ts +0 -299
- package/src/modules/dx/cardEvent/__tests__/cardEvent.test.ts +0 -99
- package/src/modules/dx/cardEvent/__tests__/mockProps.ts +0 -10
- package/src/modules/dx/cardEvent/cardEvent.stories.ts +0 -152
- package/src/modules/dx/cardGrid/__tests__/cardMockProps.ts +0 -431
- package/src/modules/dx/cardGrid/__tests__/mockProps.ts +0 -15
- package/src/modules/dx/cardGrid/cardGrid.stories.ts +0 -111
- package/src/modules/dx/cardNews/__tests__/cardNews.test.ts +0 -59
- package/src/modules/dx/cardNews/__tests__/mockProps.ts +0 -7
- package/src/modules/dx/cardNews/cardNews.stories.ts +0 -115
- package/src/modules/dx/cardPodcastEpisode/__tests__/cardPodcastEpisode.test.ts +0 -70
- package/src/modules/dx/cardPodcastEpisode/cardPodcastEpisode.stories.ts +0 -31
- package/src/modules/dx/cardPodcastEpisodeProvider/__tests__/cardPodcastEpisodeProvider.test.ts +0 -36
- package/src/modules/dx/cardPodcastEpisodeProvider/__tests__/mockWordpressEpisodes.ts +0 -50
- package/src/modules/dx/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.css +0 -3
- package/src/modules/dx/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.html +0 -12
- package/src/modules/dx/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.ts +0 -29
- package/src/modules/dx/cardSmall/__tests__/cardSmall.test.ts +0 -70
- package/src/modules/dx/cardSmall/__tests__/mockProps.ts +0 -8
- package/src/modules/dx/cardSmall/cardSmall.stories.ts +0 -166
- package/src/modules/dx/cardTitle/__tests__/cardTitle.test.ts +0 -46
- package/src/modules/dx/cardTrailheadModule/__tests__/cardTrailheadModule.test.ts +0 -18
- package/src/modules/dx/cardTrailheadModule/__tests__/mockProps.ts +0 -11
- package/src/modules/dx/cardTrailheadModule/cardTrailheadModule.stories.ts +0 -122
- package/src/modules/dx/cardVideoPreview/__tests__/cardVideoPreview.test.ts +0 -22
- package/src/modules/dx/cardVideoPreview/__tests__/mockProps.ts +0 -11
- package/src/modules/dx/cardVideoPreview/cardVideoPreview.stories.ts +0 -147
- package/src/modules/dx/checkbox/__tests__/checkbox.test.ts +0 -86
- package/src/modules/dx/checkbox/__tests__/mockProps.ts +0 -5
- package/src/modules/dx/checkbox/checkbox.stories.ts +0 -38
- package/src/modules/dx/checkboxGroup/__tests__/checkboxGroup.test.ts +0 -80
- package/src/modules/dx/checkboxGroup/__tests__/mockProps.ts +0 -14
- package/src/modules/dx/checkboxGroup/checkboxGroup.stories.ts +0 -33
- package/src/modules/dx/codeBlock/__tests__/codeBlock.test.ts +0 -242
- package/src/modules/dx/codeBlock/__tests__/mockProps.ts +0 -160
- package/src/modules/dx/codeBlock/codeBlock.stories.ts +0 -143
- package/src/modules/dx/codeBlock/darkTheme.css +0 -88
- package/src/modules/dx/codeBlock/lightTheme.css +0 -72
- package/src/modules/dx/dropdown/__tests__/dropdown.test.ts +0 -172
- package/src/modules/dx/dropdown/__tests__/mockNestedOptions.ts +0 -96
- package/src/modules/dx/dropdown/__tests__/mockOptions.ts +0 -10
- package/src/modules/dx/dropdown/__tests__/mockProps.ts +0 -6
- package/src/modules/dx/dropdown/dropdown.stories.ts +0 -89
- package/src/modules/dx/dropdownOption/__tests__/dropdownOption.test.ts +0 -112
- package/src/modules/dx/dropdownOption/__tests__/mockProps.ts +0 -20
- package/src/modules/dx/emptyState/__tests__/emptyState.test.ts +0 -52
- package/src/modules/dx/emptyState/__tests__/mockProps.ts +0 -4
- package/src/modules/dx/emptyState/emptyState.stories.ts +0 -45
- package/src/modules/dx/feature/__tests__/feature.test.ts +0 -50
- package/src/modules/dx/feature/__tests__/mockProps.ts +0 -8
- package/src/modules/dx/featureGrid/__tests__/featureGrid.test.ts +0 -21
- package/src/modules/dx/featureGrid/featureGrid.stories.ts +0 -120
- package/src/modules/dx/featuredContentHeader/__tests__/featuredContentHeader.test.ts +0 -191
- package/src/modules/dx/featuredContentHeader/__tests__/mockProps.ts +0 -73
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.stories.ts +0 -153
- package/src/modules/dx/featuresList/__tests__/featuresList.test.ts +0 -47
- package/src/modules/dx/featuresList/__tests__/mockProps.ts +0 -17
- package/src/modules/dx/featuresList/featuresList.stories.ts +0 -30
- package/src/modules/dx/footer/__tests__/footer.test.ts +0 -147
- package/src/modules/dx/footer/__tests__/mockLocales.ts +0 -7
- package/src/modules/dx/footer/footer.stories.ts +0 -88
- package/src/modules/dx/footerOption/__tests__/footerOption.test.ts +0 -34
- package/src/modules/dx/footerOption/__tests__/mockProps.ts +0 -7
- package/src/modules/dx/formattedDateTime/__tests__/formattedDateTime.test.ts +0 -25
- package/src/modules/dx/formattedDateTime/__tests__/mockProps.ts +0 -13
- package/src/modules/dx/formattedDateTime/formattedDateTime.stories.ts +0 -103
- package/src/modules/dx/grid/__tests__/grid.test.ts +0 -37
- package/src/modules/dx/grid/grid.stories.ts +0 -134
- package/src/modules/dx/groupBio/__tests__/groupBio.test.ts +0 -82
- package/src/modules/dx/groupBio/__tests__/mockProps.ts +0 -15
- package/src/modules/dx/groupBio/groupBio.css +0 -49
- package/src/modules/dx/groupBio/groupBio.html +0 -29
- package/src/modules/dx/groupBio/groupBio.stories.ts +0 -66
- package/src/modules/dx/groupBio/groupBio.ts +0 -41
- package/src/modules/dx/groupText/__tests__/groupText.test.ts +0 -73
- package/src/modules/dx/groupText/__tests__/mockProps.ts +0 -35
- package/src/modules/dx/groupText/groupText.stories.ts +0 -81
- package/src/modules/dx/headTags/headTags.html +0 -3
- package/src/modules/dx/headTags/headTags.ts +0 -39
- package/src/modules/dx/header/__benchmarks__/header.benchmark.js +0 -45
- package/src/modules/dx/header/__tests__/header.test.ts +0 -242
- package/src/modules/dx/header/__tests__/mockNavArchitects.ts +0 -169
- package/src/modules/dx/header/__tests__/mockNavDevelopers.ts +0 -419
- package/src/modules/dx/header/__tests__/mockNavs.ts +0 -115
- package/src/modules/dx/header/__tests__/mockProps.ts +0 -164
- package/src/modules/dx/header/header.css +0 -109
- package/src/modules/dx/header/header.html +0 -128
- package/src/modules/dx/header/header.stories.ts +0 -172
- package/src/modules/dx/header/header.ts +0 -27
- package/src/modules/dx/headerMobileNavMenu/__tests__/headerMobileNavMenu.test.ts +0 -123
- package/src/modules/dx/headerMobileNavMenuOption/__tests__/headerMobileNavMenuOption.test.ts +0 -38
- package/src/modules/dx/headerNav/__tests__/headerNav.test.ts +0 -49
- package/src/modules/dx/headerSearch/__tests__/headerSearch.test.ts +0 -198
- package/src/modules/dx/headerSearch/__tests__/mockData.ts +0 -11
- package/src/modules/dx/headerSearch/__tests__/mockProps.ts +0 -11
- package/src/modules/dx/headerSearch/headerSearch.css +0 -62
- package/src/modules/dx/headerSearch/headerSearch.html +0 -65
- package/src/modules/dx/headerSearch/headerSearch.ts +0 -161
- package/src/modules/dx/helmet/__tests__/helmet.test.ts +0 -53
- package/src/modules/dx/helmet/helmet.stories.ts +0 -53
- package/src/modules/dx/hr/__tests__/hr.test.ts +0 -53
- package/src/modules/dx/hr/__tests__/mockProps.ts +0 -16
- package/src/modules/dx/hr/hr.stories.ts +0 -50
- package/src/modules/dx/icon/__tests__/icon.test.ts +0 -54
- package/src/modules/dx/icon/icon.stories.ts +0 -100
- package/src/modules/dx/iconBadge/__tests__/iconBadge.test.ts +0 -17
- package/src/modules/dx/iconBadge/iconBadge.stories.ts +0 -32
- package/src/modules/dx/imageAndLabel/__tests__/imageAndLabel.test.ts +0 -39
- package/src/modules/dx/imageAndLabel/__tests__/mockProps.ts +0 -6
- package/src/modules/dx/imageAndLabel/imageAndLabel.stories.ts +0 -48
- package/src/modules/dx/input/__tests__/input.test.ts +0 -368
- package/src/modules/dx/input/input.stories.ts +0 -102
- package/src/modules/dx/instrumentation/__tests__/instrumentation.test.ts +0 -86
- package/src/modules/dx/instrumentation/instrumentation.ts +0 -116
- package/src/modules/dx/interactiveImage/__tests__/interactiveImage.test.ts +0 -86
- package/src/modules/dx/interactiveImage/__tests__/mockProps.ts +0 -39
- package/src/modules/dx/interactiveImage/interactiveImage.stories.ts +0 -31
- package/src/modules/dx/lazy/__tests__/lazy.test.ts +0 -43
- package/src/modules/dx/lazy/lazy.html +0 -5
- package/src/modules/dx/lazy/lazy.stories.ts +0 -132
- package/src/modules/dx/lazy/lazy.ts +0 -170
- package/src/modules/dx/newsletterForm/newsletterForm.css +0 -73
- package/src/modules/dx/newsletterForm/newsletterForm.html +0 -73
- package/src/modules/dx/newsletterForm/newsletterForm.ts +0 -229
- package/src/modules/dx/pagination/__tests__/pagination.test.ts +0 -121
- package/src/modules/dx/pagination/pagination.stories.ts +0 -88
- package/src/modules/dx/podcastHost/__tests__/mockProps.ts +0 -8
- package/src/modules/dx/podcastHost/__tests__/podcastHost.test.ts +0 -21
- package/src/modules/dx/podcastHost/podcastHost.stories.ts +0 -17
- package/src/modules/dx/podcastPlayer/__tests__/podcastPlayer.test.ts +0 -20
- package/src/modules/dx/podcastPlayer/podcastPlayer.stories.ts +0 -13
- package/src/modules/dx/podcastSubscription/__tests__/podcastSubscription.test.ts +0 -16
- package/src/modules/dx/podcastSubscription/podcastSubscription.css +0 -92
- package/src/modules/dx/podcastSubscription/podcastSubscription.html +0 -24
- package/src/modules/dx/podcastSubscription/podcastSubscription.stories.ts +0 -23
- package/src/modules/dx/podcastSubscription/podcastSubscription.ts +0 -58
- package/src/modules/dx/popover/__tests__/mockProps.ts +0 -8
- package/src/modules/dx/popover/__tests__/popover.test.ts +0 -321
- package/src/modules/dx/popover/popover.stories.ts +0 -82
- package/src/modules/dx/radioGroup/__tests__/mockProps.ts +0 -12
- package/src/modules/dx/radioGroup/__tests__/radioGroup.test.ts +0 -42
- package/src/modules/dx/radioGroup/radioGroup.stories.ts +0 -25
- package/src/modules/dx/relativeDateTime/__tests__/mockProps.ts +0 -55
- package/src/modules/dx/relativeDateTime/__tests__/relativeDateTime.test.ts +0 -52
- package/src/modules/dx/relativeDateTime/relativeDateTime.stories.ts +0 -83
- package/src/modules/dx/searchResults/searchResults.stories.ts +0 -36
- package/src/modules/dx/section/__tests__/section.test.ts +0 -17
- package/src/modules/dx/section/section.stories.ts +0 -381
- package/src/modules/dx/sectionSignup/__tests__/sectionSignup.test.ts +0 -66
- package/src/modules/dx/sectionSignup/sectionSignup.stories.ts +0 -49
- package/src/modules/dx/select/select.stories.ts +0 -59
- package/src/modules/dx/sidebar/__tests__/mockProps.ts +0 -181
- package/src/modules/dx/sidebar/__tests__/sidebar.test.ts +0 -609
- package/src/modules/dx/sidebar/sidebar.stories.ts +0 -139
- package/src/modules/dx/socials/__tests__/socials.test.ts +0 -124
- package/src/modules/dx/socials/socials.stories.ts +0 -24
- package/src/modules/dx/spinner/__tests__/spinner.test.ts +0 -37
- package/src/modules/dx/spinner/spinner.stories.ts +0 -69
- package/src/modules/dx/tab/__tests__/tab.test.ts +0 -129
- package/src/modules/dx/tab/tab.stories.ts +0 -57
- package/src/modules/dx/toc/__tests__/mockProps.ts +0 -22
- package/src/modules/dx/toc/__tests__/toc.test.ts +0 -115
- package/src/modules/dx/toc/toc.stories.ts +0 -26
- package/src/modules/dx/tooltip/__tests__/tooltip.test.ts +0 -23
- package/src/modules/dx/tooltip/tooltip.stories.ts +0 -46
- package/src/modules/dx/tree/__tests__/mockProps.ts +0 -215
- package/src/modules/dx/tree/__tests__/tree.test.ts +0 -357
- package/src/modules/dx/tree/__tests__/treeHandler.test.ts +0 -194
- package/src/modules/dx/tree/tree.stories.ts +0 -65
- package/src/modules/dx/treeItem/__tests__/mockProps.ts +0 -46
- package/src/modules/dx/treeItem/__tests__/treeItem.test.ts +0 -400
- package/src/modules/dx/treeTile/__tests__/mockProps.ts +0 -16
- package/src/modules/dx/treeTile/__tests__/treeTile.test.ts +0 -179
- package/src/modules/dx/typeBadge/__tests__/typeBadge.test.ts +0 -63
- package/src/modules/dx/typeBadge/typeBadge.stories.ts +0 -79
- package/src/modules/dx/typeBadgeGroup/__tests__/mockProps.ts +0 -11
- package/src/modules/dx/typeBadgeGroup/__tests__/typeBadgeGroup.test.ts +0 -76
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.css +0 -12
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.html +0 -11
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.stories.ts +0 -19
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.ts +0 -18
- package/src/modules/helpers/button/button.css +0 -4
- package/src/modules/helpers/slds/slds.css +0 -191
- package/src/modules/tests/buttonTest/buttonTest.html +0 -3
- package/src/modules/tests/buttonTest/buttonTest.ts +0 -3
- package/src/modules/tests/codeBlockTest/codeBlockTest.js +0 -4
- package/src/modules/tests/featureGridTest/featureGridTest.html +0 -7
- package/src/modules/tests/featureGridTest/featureGridTest.ts +0 -5
- package/src/modules/tests/instrumentationTest/instrumentationTest.html +0 -4
- package/src/modules/tests/instrumentationTest/instrumentationTest.ts +0 -8
- package/src/modules/tests/popoverTest/popoverTest.html +0 -6
- package/src/modules/tests/popoverTest/popoverTest.ts +0 -5
- package/src/modules/utils/css/css.ts +0 -2
- package/src/modules/utils/jest/jest.ts +0 -23
- package/src/modules/utils/normalizers/normalizers.ts +0 -91
- package/src/modules/utils/prismjs/prismjs.ts +0 -3225
- package/src/modules/utils/storybook/storybook.ts +0 -33
- package/src/modules/utils/tests/tests.ts +0 -31
- package/src/modules/utils/wordpress/__tests__/wordpress.test.ts +0 -15
- /package/src/modules/dx/{instrumentation/instrumentation.html → darkModeManager/darkModeManager.html} +0 -0
- /package/src/modules/{utils → dxUtils}/devices/devices.ts +0 -0
- /package/src/modules/{utils → dxUtils}/prismjs/prismjs.html +0 -0
- /package/src/modules/{utils → dxUtils}/regexps/regexps.ts +0 -0
- /package/src/modules/{utils → dxUtils}/seo/seo.ts +0 -0
- /package/src/modules/{utils → dxUtils}/slot/slot.ts +0 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
aria-label={playerAriaLabel}
|
|
4
|
+
class="custom-audio-player"
|
|
5
|
+
lwc:ref="container"
|
|
6
|
+
onkeyup={handleContainerKeyUp}
|
|
7
|
+
tabindex="0"
|
|
8
|
+
>
|
|
9
|
+
<dx-icon
|
|
10
|
+
class="listen-icon"
|
|
11
|
+
size="xsmall"
|
|
12
|
+
sprite="general"
|
|
13
|
+
symbol="headphones"
|
|
14
|
+
></dx-icon>
|
|
15
|
+
<span class="listen-text">Listen to this article</span>
|
|
16
|
+
<div class="player">
|
|
17
|
+
<dx-button
|
|
18
|
+
aria-label={mainControlAriaLabel}
|
|
19
|
+
class="player-play-pause-button"
|
|
20
|
+
icon-symbol={mainControlIconSymbol}
|
|
21
|
+
variant="custom"
|
|
22
|
+
onclick={handleMainControlClick}
|
|
23
|
+
></dx-button>
|
|
24
|
+
<div class="player-time">
|
|
25
|
+
<span class="player-current-time">{formattedCurrentTime}</span>
|
|
26
|
+
/
|
|
27
|
+
<span class="player-duration">{formattedDuration}</span>
|
|
28
|
+
</div>
|
|
29
|
+
<input
|
|
30
|
+
aria-label="Current Time"
|
|
31
|
+
class="player-seek-slider"
|
|
32
|
+
type="range"
|
|
33
|
+
max={durationSeconds}
|
|
34
|
+
lwc:ref="playerSeekSlider"
|
|
35
|
+
value={currentTimeSeconds}
|
|
36
|
+
onchange={handleSeekChange}
|
|
37
|
+
oninput={handleSeekInput}
|
|
38
|
+
/>
|
|
39
|
+
<div
|
|
40
|
+
class="player-volume-container"
|
|
41
|
+
lwc:ref="playerVolumeContainer"
|
|
42
|
+
onfocusin={handleVolumeFocusIn}
|
|
43
|
+
onfocusout={handleVolumeFocusOut}
|
|
44
|
+
>
|
|
45
|
+
<input
|
|
46
|
+
aria-label="Volume Level"
|
|
47
|
+
class="player-volume-slider"
|
|
48
|
+
type="range"
|
|
49
|
+
max="100"
|
|
50
|
+
lwc:ref="playerVolumeSlider"
|
|
51
|
+
tabindex="0"
|
|
52
|
+
value={volume}
|
|
53
|
+
oninput={handleVolumeInput}
|
|
54
|
+
/>
|
|
55
|
+
<dx-button
|
|
56
|
+
aria-label="Volume"
|
|
57
|
+
class="player-volume-button"
|
|
58
|
+
icon-symbol={volumeIcon}
|
|
59
|
+
onclick={handleVolumeClick}
|
|
60
|
+
variant="custom"
|
|
61
|
+
></dx-button>
|
|
62
|
+
</div>
|
|
63
|
+
<dx-popover
|
|
64
|
+
lwc:ref="playbackSpeedPopover"
|
|
65
|
+
width="200px"
|
|
66
|
+
onclose={resetIsSettingPlaybackSpeed}
|
|
67
|
+
>
|
|
68
|
+
<dx-button
|
|
69
|
+
aria-label="More"
|
|
70
|
+
icon-symbol="threedots_vertical"
|
|
71
|
+
slot="control"
|
|
72
|
+
variant="custom"
|
|
73
|
+
></dx-button>
|
|
74
|
+
<div
|
|
75
|
+
class="player-threedot-menu"
|
|
76
|
+
lwc:ref="playbackSpeedMenu"
|
|
77
|
+
slot="content"
|
|
78
|
+
>
|
|
79
|
+
<template lwc:if={isSettingPlaybackSpeed}>
|
|
80
|
+
<div>
|
|
81
|
+
<ul>
|
|
82
|
+
<li>
|
|
83
|
+
<button
|
|
84
|
+
class="pane-control"
|
|
85
|
+
onclick={handlePlaybackOptionsClick}
|
|
86
|
+
>
|
|
87
|
+
<dx-icon
|
|
88
|
+
size="small"
|
|
89
|
+
symbol="back"
|
|
90
|
+
></dx-icon>
|
|
91
|
+
Options
|
|
92
|
+
</button>
|
|
93
|
+
</li>
|
|
94
|
+
<template
|
|
95
|
+
for:each={playbackSpeedData}
|
|
96
|
+
for:item="playbackSpeedDatum"
|
|
97
|
+
>
|
|
98
|
+
<li key={playbackSpeedDatum.value}>
|
|
99
|
+
<button
|
|
100
|
+
class="player-speed-item"
|
|
101
|
+
onclick={handleSetPlaybackSpeed}
|
|
102
|
+
>
|
|
103
|
+
{playbackSpeedDatum.value}
|
|
104
|
+
</button>
|
|
105
|
+
<dx-icon
|
|
106
|
+
class="player-selected-speed"
|
|
107
|
+
lwc:if={playbackSpeedDatum.selected}
|
|
108
|
+
size="small"
|
|
109
|
+
symbol="check"
|
|
110
|
+
></dx-icon>
|
|
111
|
+
</li>
|
|
112
|
+
</template>
|
|
113
|
+
</ul>
|
|
114
|
+
</div>
|
|
115
|
+
</template>
|
|
116
|
+
<template lwc:else>
|
|
117
|
+
<ul>
|
|
118
|
+
<li>
|
|
119
|
+
<a
|
|
120
|
+
href={audioSrc}
|
|
121
|
+
download
|
|
122
|
+
tabindex="0"
|
|
123
|
+
target="_blank"
|
|
124
|
+
rel="noopener"
|
|
125
|
+
>
|
|
126
|
+
<dx-icon
|
|
127
|
+
size="small"
|
|
128
|
+
symbol="download"
|
|
129
|
+
></dx-icon>
|
|
130
|
+
Download
|
|
131
|
+
</a>
|
|
132
|
+
</li>
|
|
133
|
+
<li>
|
|
134
|
+
<button
|
|
135
|
+
class="pane-control"
|
|
136
|
+
onclick={handlePlaybackSpeedClick}
|
|
137
|
+
>
|
|
138
|
+
<dx-icon
|
|
139
|
+
size="small"
|
|
140
|
+
sprite="general"
|
|
141
|
+
symbol="tachometer-alt"
|
|
142
|
+
></dx-icon>
|
|
143
|
+
Playback Speed
|
|
144
|
+
</button>
|
|
145
|
+
</li>
|
|
146
|
+
</ul>
|
|
147
|
+
</template>
|
|
148
|
+
</div>
|
|
149
|
+
</dx-popover>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
<div class="audio-container">
|
|
153
|
+
<audio lwc:ref="audioElement" class="audio" controls>
|
|
154
|
+
<source src={audioSrc} type="audio/mpeg" />
|
|
155
|
+
Your browser does not support the audio element.
|
|
156
|
+
</audio>
|
|
157
|
+
</div>
|
|
158
|
+
</template>
|
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
import { api } from "lwc";
|
|
2
|
+
import memoize from "memoize-one";
|
|
3
|
+
import Popover from "dx/popover";
|
|
4
|
+
import { track } from "dxUtils/analytics";
|
|
5
|
+
import { LightningElementWithTypedRefs } from "dxUtils/withTypedRefs";
|
|
6
|
+
|
|
7
|
+
type TrackColors = {
|
|
8
|
+
before: string;
|
|
9
|
+
buffer?: string;
|
|
10
|
+
after: string;
|
|
11
|
+
};
|
|
12
|
+
// eslint-disable-next-line no-use-before-define
|
|
13
|
+
type PlaybackSpeed = (typeof formattedPlaybackSpeeds)[number];
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
* Color settings for the "track" of the slider, which dynamically updates based on amount buffered,
|
|
17
|
+
* amount played, and amount remaining. The "before" color is what goes _before_ the "thumb" on the
|
|
18
|
+
* slider, and so on.
|
|
19
|
+
*/
|
|
20
|
+
const uiConfig = {
|
|
21
|
+
seekSlider: {
|
|
22
|
+
trackColors: {
|
|
23
|
+
before: "var(--dx-c-track-before-color)",
|
|
24
|
+
buffer: "var(--dx-c-track-custom-medium-gray)",
|
|
25
|
+
after: "var(--dx-c-track-custom-light-gray)"
|
|
26
|
+
} as TrackColors
|
|
27
|
+
},
|
|
28
|
+
volumeSlider: {
|
|
29
|
+
trackColors: {
|
|
30
|
+
before: "var(--dx-g-indigo-vibrant-30)",
|
|
31
|
+
after: "var(--dx-c-track-custom-medium-gray)"
|
|
32
|
+
} as TrackColors
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// Standard playback speeds, though the "formatted" version for 1 is "Normal" (mimicking Chrome)
|
|
37
|
+
const formattedPlaybackSpeeds = [
|
|
38
|
+
"0.25",
|
|
39
|
+
"0.5",
|
|
40
|
+
"0.75",
|
|
41
|
+
"Normal",
|
|
42
|
+
"1.25",
|
|
43
|
+
"1.5",
|
|
44
|
+
"1.75",
|
|
45
|
+
"2"
|
|
46
|
+
] as const;
|
|
47
|
+
|
|
48
|
+
export default class Audio extends LightningElementWithTypedRefs<{
|
|
49
|
+
audioElement: HTMLAudioElement;
|
|
50
|
+
container: HTMLDivElement;
|
|
51
|
+
playbackSpeedMenu: HTMLDivElement;
|
|
52
|
+
playbackSpeedPopover: Popover;
|
|
53
|
+
playerSeekSlider: HTMLInputElement;
|
|
54
|
+
playerVolumeSlider: HTMLInputElement;
|
|
55
|
+
playerVolumeContainer: HTMLDivElement;
|
|
56
|
+
}> {
|
|
57
|
+
@api audioSrc!: string;
|
|
58
|
+
@api audioTitle!: string;
|
|
59
|
+
|
|
60
|
+
private _bufferedTimeRanges?: TimeRanges;
|
|
61
|
+
private _currentTimeSeconds = 0;
|
|
62
|
+
private _durationSeconds = 0;
|
|
63
|
+
private _volume = 100; // 100 is browser default (and max), at least in Chrome, for audio elements
|
|
64
|
+
private animationFrameId: number | null = null; // controls movement of the timeline when audio is playing
|
|
65
|
+
private currentPlaybackSpeed: PlaybackSpeed = "Normal";
|
|
66
|
+
private didRender = false;
|
|
67
|
+
private isAnimating = false;
|
|
68
|
+
private isPlaying = false;
|
|
69
|
+
private isSettingPlaybackSpeed = false; // popover menu has two panes; this manages that state
|
|
70
|
+
// `playbackSpeedData` tracks which value is selected, in a way useable by LWC for:each without requiring a separate sub-component
|
|
71
|
+
private playbackSpeedData = formattedPlaybackSpeeds.map((value) => ({
|
|
72
|
+
selected: value === "Normal",
|
|
73
|
+
value
|
|
74
|
+
}));
|
|
75
|
+
private prevVolume = this._volume; // previous volume is tracked so that it can be restored on unmute
|
|
76
|
+
private volumeIcon: "volume_high" | "volume_off" = "volume_high"; // built-in browser UI doesn't distinguish between high/low, just "on"/"off" (we use the "high" icon for "on")
|
|
77
|
+
|
|
78
|
+
private get formattedCurrentTime() {
|
|
79
|
+
return this.getFormatted(this.currentTimeSeconds);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private get formattedDuration() {
|
|
83
|
+
return this.getFormatted(this.durationSeconds);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
private get mainControlAriaLabel() {
|
|
87
|
+
return this.isPlaying ? "Pause" : "Play";
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
private get mainControlIconSymbol() {
|
|
91
|
+
return this.isPlaying ? "pause" : "play";
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private get playerAriaLabel() {
|
|
95
|
+
return `Audio: ${this.audioTitle}`;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// NOTE that values with getters and setters here have side effects that update the UI elements.
|
|
99
|
+
// This essentially makes these items the source of truth for the UI.
|
|
100
|
+
private get bufferedTimeRanges() {
|
|
101
|
+
return this._bufferedTimeRanges;
|
|
102
|
+
}
|
|
103
|
+
private set bufferedTimeRanges(value: TimeRanges | undefined) {
|
|
104
|
+
this._bufferedTimeRanges = value;
|
|
105
|
+
this.updateRangeInputStyles(
|
|
106
|
+
this.typedRefs.playerSeekSlider,
|
|
107
|
+
this.currentTimeSeconds
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
private get currentTimeSeconds() {
|
|
112
|
+
return this._currentTimeSeconds;
|
|
113
|
+
}
|
|
114
|
+
private set currentTimeSeconds(value: number) {
|
|
115
|
+
this._currentTimeSeconds = value;
|
|
116
|
+
this.updateRangeInputStyles(this.typedRefs.playerSeekSlider, value);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private get durationSeconds() {
|
|
120
|
+
return this._durationSeconds;
|
|
121
|
+
}
|
|
122
|
+
private set durationSeconds(value: number) {
|
|
123
|
+
if (!Number.isFinite(value)) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
this._durationSeconds = value;
|
|
127
|
+
this.updateRangeInputStyles(
|
|
128
|
+
this.typedRefs.playerSeekSlider,
|
|
129
|
+
this.currentTimeSeconds
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
private get volume() {
|
|
134
|
+
return this._volume;
|
|
135
|
+
}
|
|
136
|
+
private set volume(value: number) {
|
|
137
|
+
this.prevVolume = this.volume;
|
|
138
|
+
this._volume = value;
|
|
139
|
+
this.updateRangeInputStyles(this.typedRefs.playerVolumeSlider, value);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
renderedCallback(): void {
|
|
143
|
+
if (this.didRender) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
this.didRender = true;
|
|
148
|
+
this.volume = this.typedRefs.audioElement.volume * 100;
|
|
149
|
+
|
|
150
|
+
// We only need to listen for the metadata event if the metadata isn't already loaded;
|
|
151
|
+
// sometimes, browsers can load it _before_ the event handler can even be added.
|
|
152
|
+
if (this.typedRefs.audioElement.readyState > 0) {
|
|
153
|
+
this.handleAudioLoadedMetadata();
|
|
154
|
+
} else {
|
|
155
|
+
this.typedRefs.audioElement.addEventListener(
|
|
156
|
+
"loadedmetadata",
|
|
157
|
+
this.handleAudioLoadedMetadata
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// "progress" handles buffering of audio data, lets us update the UI for the buffered amount
|
|
162
|
+
this.typedRefs.audioElement.addEventListener(
|
|
163
|
+
"progress",
|
|
164
|
+
this.handleAudioProgress
|
|
165
|
+
);
|
|
166
|
+
this.typedRefs.audioElement.addEventListener(
|
|
167
|
+
"ended",
|
|
168
|
+
this.handleAudioEnded
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
disconnectedCallback(): void {
|
|
173
|
+
this.typedRefs.audioElement.removeEventListener(
|
|
174
|
+
"loadedmetadata",
|
|
175
|
+
this.handleAudioLoadedMetadata
|
|
176
|
+
);
|
|
177
|
+
this.typedRefs.audioElement.removeEventListener(
|
|
178
|
+
"progress",
|
|
179
|
+
this.handleAudioProgress
|
|
180
|
+
);
|
|
181
|
+
this.typedRefs.audioElement.removeEventListener(
|
|
182
|
+
"ended",
|
|
183
|
+
this.handleAudioEnded
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* BEGIN event handlers */
|
|
188
|
+
|
|
189
|
+
handleAudioLoadedMetadata = () => {
|
|
190
|
+
// `loadedmetadata` is the first spot at which duration is available.
|
|
191
|
+
this.durationSeconds = this.typedRefs.audioElement.duration;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
handleAudioProgress = () => {
|
|
195
|
+
// New buffered amount received, store the buffered time ranges.
|
|
196
|
+
this.bufferedTimeRanges = this.typedRefs.audioElement.buffered;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
handleMainControlClick = (event: Event) => {
|
|
200
|
+
if (this.isPlaying) {
|
|
201
|
+
this.handleAudioPause(event);
|
|
202
|
+
} else {
|
|
203
|
+
this.handleAudioPlay(event);
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
handleAudioPlay = (event: Event) => {
|
|
208
|
+
this.typedRefs.audioElement.play();
|
|
209
|
+
this.syncTimeWithAudio();
|
|
210
|
+
this.isPlaying = true;
|
|
211
|
+
this.trackPlay(event);
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
handleAudioPause = (event: Event) => {
|
|
215
|
+
this.typedRefs.audioElement.pause();
|
|
216
|
+
cancelAnimationFrame(this.animationFrameId as number);
|
|
217
|
+
this.isPlaying = false;
|
|
218
|
+
this.trackPause(event);
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
handleAudioEnded = (event: Event) => {
|
|
222
|
+
cancelAnimationFrame(this.animationFrameId as number);
|
|
223
|
+
this.isPlaying = false;
|
|
224
|
+
this.trackEnded(event);
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
// Handles any user-driven movement on the "seek" slider (timeline)
|
|
228
|
+
handleSeekInput = () => {
|
|
229
|
+
if (!this.durationSeconds) {
|
|
230
|
+
// No moving the "thumb" when metadata hasn't even loaded.
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (this.isPlaying) {
|
|
235
|
+
// To allow the user to interact with the slider, we temporarily have to stop moving the
|
|
236
|
+
// "thumb," but leave the player in the "isPlaying" state so that the play button
|
|
237
|
+
// remains and audio picks back up once the user is done interacting (the last bit is
|
|
238
|
+
// handled in the `handleSeekChange` handler, when the user actually commits the change)
|
|
239
|
+
cancelAnimationFrame(this.animationFrameId as number);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
this.currentTimeSeconds = parseInt(
|
|
243
|
+
this.typedRefs.playerSeekSlider.value,
|
|
244
|
+
10
|
|
245
|
+
);
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
// `change` is only fired once the user *commits* to a value (e.g., by releasing the mouse click), unlike `input` above
|
|
249
|
+
handleSeekChange = () => {
|
|
250
|
+
if (this.isPlaying) {
|
|
251
|
+
// Resume playing after user finishes interacting with seek slider, if the audio was
|
|
252
|
+
// already playing (see note in `handleSeekInput`)
|
|
253
|
+
this.syncTimeWithAudio();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
this.currentTimeSeconds = parseInt(
|
|
257
|
+
this.typedRefs.playerSeekSlider.value,
|
|
258
|
+
10
|
|
259
|
+
);
|
|
260
|
+
this.typedRefs.audioElement!.currentTime = this.currentTimeSeconds;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
// Handles any user-driven movement on the volume slider
|
|
264
|
+
handleVolumeInput = ({
|
|
265
|
+
currentTarget
|
|
266
|
+
}: InputEvent & { currentTarget: HTMLInputElement }) => {
|
|
267
|
+
this.volume = parseInt(currentTarget.value, 10);
|
|
268
|
+
this.typedRefs.audioElement.volume = this.volume / 100;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
// Direct click on the volume button is mute/unmute
|
|
272
|
+
handleVolumeClick = () => {
|
|
273
|
+
if (this.typedRefs.audioElement.muted) {
|
|
274
|
+
this.typedRefs.audioElement.muted = false;
|
|
275
|
+
this.volumeIcon = "volume_high";
|
|
276
|
+
this.volume = this.prevVolume; // restore to previous volume level
|
|
277
|
+
} else {
|
|
278
|
+
this.typedRefs.audioElement.muted = true;
|
|
279
|
+
this.volumeIcon = "volume_off";
|
|
280
|
+
this.volume = 0;
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
handleVolumeFocusIn = () => {
|
|
285
|
+
this.typedRefs.playerVolumeContainer.classList.add(
|
|
286
|
+
"focused-by-keyboard"
|
|
287
|
+
);
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
handleVolumeFocusOut = (event: FocusEvent) => {
|
|
291
|
+
const { playerVolumeContainer } = this.typedRefs;
|
|
292
|
+
const isFocusingChildOfVolumeContainer = Array.from(
|
|
293
|
+
playerVolumeContainer.children
|
|
294
|
+
).some((childElement) => event.relatedTarget === childElement);
|
|
295
|
+
|
|
296
|
+
if (!isFocusingChildOfVolumeContainer) {
|
|
297
|
+
this.typedRefs.playerVolumeContainer.classList.remove(
|
|
298
|
+
"focused-by-keyboard"
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
// Set "pane" state for playback popover menu
|
|
304
|
+
handlePlaybackSpeedClick = () => {
|
|
305
|
+
this.handlePlaybackMenuNavigation(true);
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
handlePlaybackOptionsClick = () => {
|
|
309
|
+
this.handlePlaybackMenuNavigation(false);
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
handlePlaybackMenuNavigation = (isSettingPlaybackSpeed: boolean) => {
|
|
313
|
+
this.isSettingPlaybackSpeed = isSettingPlaybackSpeed;
|
|
314
|
+
this.refocusPlaybackSpeedMenu();
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
resetIsSettingPlaybackSpeed = () => {
|
|
318
|
+
this.isSettingPlaybackSpeed = false;
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
// Handle selection of a playback speed in the "three dot" menu
|
|
322
|
+
handleSetPlaybackSpeed = (event: Event) => {
|
|
323
|
+
const currentTarget = event.currentTarget as Node;
|
|
324
|
+
const selectedPlaybackSpeed =
|
|
325
|
+
currentTarget.textContent as PlaybackSpeed;
|
|
326
|
+
|
|
327
|
+
if (selectedPlaybackSpeed === this.currentPlaybackSpeed) {
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
this.playbackSpeedData = formattedPlaybackSpeeds.map((value) => ({
|
|
332
|
+
selected: value === selectedPlaybackSpeed,
|
|
333
|
+
value
|
|
334
|
+
}));
|
|
335
|
+
this.currentPlaybackSpeed = selectedPlaybackSpeed;
|
|
336
|
+
this.typedRefs.playbackSpeedPopover.closePopover();
|
|
337
|
+
this.resetIsSettingPlaybackSpeed();
|
|
338
|
+
this.typedRefs.audioElement.playbackRate =
|
|
339
|
+
selectedPlaybackSpeed === "Normal"
|
|
340
|
+
? 1
|
|
341
|
+
: parseFloat(selectedPlaybackSpeed);
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
handleContainerKeyUp = (event: KeyboardEvent) => {
|
|
345
|
+
if (event.key === " " && event.target === this.typedRefs.container) {
|
|
346
|
+
if (this.isPlaying) {
|
|
347
|
+
this.handleAudioPause(event);
|
|
348
|
+
} else {
|
|
349
|
+
this.handleAudioPlay(event);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
/* END event handlers, BEGIN private utility methods */
|
|
355
|
+
|
|
356
|
+
// Called when menu's inner pane changes, ensuring focus is on the newly-displayed menu
|
|
357
|
+
private refocusPlaybackSpeedMenu = () => {
|
|
358
|
+
// Promise.resolve() allows LWC to re-render before we select
|
|
359
|
+
Promise.resolve().then(() =>
|
|
360
|
+
(
|
|
361
|
+
this.typedRefs.playbackSpeedMenu.querySelector(
|
|
362
|
+
".pane-control"
|
|
363
|
+
) as HTMLButtonElement
|
|
364
|
+
).focus()
|
|
365
|
+
);
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
// Animates the seek slider (timeline) each frame so that it is N*Sync with current play
|
|
369
|
+
// time. We do this using requestAnimationFrame so that we can temporarily cancel the
|
|
370
|
+
// animating whenever the user is interacting with the slider.
|
|
371
|
+
private syncTimeWithAudio = () => {
|
|
372
|
+
this.currentTimeSeconds = Math.floor(
|
|
373
|
+
this.typedRefs.audioElement.currentTime
|
|
374
|
+
);
|
|
375
|
+
this.animationFrameId = requestAnimationFrame(this.syncTimeWithAudio);
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
// Convert raw numerical seconds to strings formatted as "X:XX"
|
|
379
|
+
private getFormatted(totalSeconds: number) {
|
|
380
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
381
|
+
const seconds = Math.floor(totalSeconds % 60);
|
|
382
|
+
const doubleDigitSeconds = seconds < 10 ? `0${seconds}` : `${seconds}`;
|
|
383
|
+
return `${minutes}:${doubleDigitSeconds}`;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// Find the end of the buffered amount of audio, if any, that overlaps with the current
|
|
387
|
+
// position. We care about the overlap because buffered time ranges can have gaps.
|
|
388
|
+
// Memoized because it is called whenever input styles are updated, and bufferedTimeRanges
|
|
389
|
+
// rarely changes.
|
|
390
|
+
private getOverlappingBufferEnd = memoize(
|
|
391
|
+
(currentTimeSeconds: number, bufferedTimeRanges?: TimeRanges) => {
|
|
392
|
+
let nearestBufferEnd = 0;
|
|
393
|
+
|
|
394
|
+
if (bufferedTimeRanges?.length) {
|
|
395
|
+
for (let i = 0; i < bufferedTimeRanges.length; i++) {
|
|
396
|
+
if (
|
|
397
|
+
bufferedTimeRanges.start(i) <= currentTimeSeconds &&
|
|
398
|
+
bufferedTimeRanges.end(i) > currentTimeSeconds
|
|
399
|
+
) {
|
|
400
|
+
nearestBufferEnd = bufferedTimeRanges.end(i);
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
return nearestBufferEnd;
|
|
407
|
+
}
|
|
408
|
+
);
|
|
409
|
+
|
|
410
|
+
// Visually updates sliders (timeline or volume) so that the amount "covered" (before the
|
|
411
|
+
// "thumb") is visually different than the amount remaining; also handles visually showing the
|
|
412
|
+
// buffered amount if there is buffer data and the element is the "seek"/timeline slider
|
|
413
|
+
private updateRangeInputStyles(
|
|
414
|
+
target: HTMLInputElement | null,
|
|
415
|
+
currentValue: number
|
|
416
|
+
) {
|
|
417
|
+
if (
|
|
418
|
+
!target ||
|
|
419
|
+
(target === this.typedRefs.playerSeekSlider &&
|
|
420
|
+
!this.durationSeconds)
|
|
421
|
+
) {
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
const maximumValue =
|
|
426
|
+
target === this.typedRefs.playerVolumeSlider
|
|
427
|
+
? 100
|
|
428
|
+
: this.durationSeconds;
|
|
429
|
+
const trackColors =
|
|
430
|
+
target === this.typedRefs.playerVolumeSlider
|
|
431
|
+
? uiConfig.volumeSlider.trackColors
|
|
432
|
+
: uiConfig.seekSlider.trackColors;
|
|
433
|
+
const percentageCovered =
|
|
434
|
+
maximumValue === 100
|
|
435
|
+
? currentValue
|
|
436
|
+
: (currentValue / maximumValue) * 100;
|
|
437
|
+
const overlappingBufferEnd = this.getOverlappingBufferEnd(
|
|
438
|
+
this.currentTimeSeconds,
|
|
439
|
+
this.bufferedTimeRanges
|
|
440
|
+
);
|
|
441
|
+
|
|
442
|
+
if (trackColors.buffer && overlappingBufferEnd) {
|
|
443
|
+
// Slider with three colors: the before amount, the buffered amount, and the full
|
|
444
|
+
// "remaining" slider color.
|
|
445
|
+
const bufferPercentage =
|
|
446
|
+
(overlappingBufferEnd / maximumValue) * 100;
|
|
447
|
+
target.style.background = `linear-gradient(to right, ${trackColors.before} ${percentageCovered}%, ${trackColors.buffer} ${percentageCovered}% ${bufferPercentage}%, ${trackColors.after} ${bufferPercentage}%)`;
|
|
448
|
+
} else {
|
|
449
|
+
// "Basic" slider, with only two colors, no buffering.
|
|
450
|
+
target.style.background = `linear-gradient(to right, ${trackColors.before} ${percentageCovered}%, ${trackColors.after} ${percentageCovered}%)`;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
private trackClick = (e: Event, eventType: string, action: string) => {
|
|
455
|
+
const payload = {
|
|
456
|
+
event: eventType,
|
|
457
|
+
media_action: action,
|
|
458
|
+
media_name: this.audioTitle,
|
|
459
|
+
media_percentage_played:
|
|
460
|
+
this.durationSeconds === 0
|
|
461
|
+
? this.durationSeconds
|
|
462
|
+
: (
|
|
463
|
+
(this.currentTimeSeconds * 100) /
|
|
464
|
+
this.durationSeconds
|
|
465
|
+
).toFixed(0),
|
|
466
|
+
media_seconds_played: this.currentTimeSeconds,
|
|
467
|
+
media_type: "blog audio"
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
track(e.currentTarget!, "custEv_blogAudioPlay", payload);
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
private trackPlay = (e: Event) => {
|
|
474
|
+
this.trackClick(e, "custEv_blogAudioPlay", "play");
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
private trackEnded = (e: Event) => {
|
|
478
|
+
this.trackClick(e, "custEv_blogAudioComplete", "complete");
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
private trackPause = (e: Event) => {
|
|
482
|
+
this.trackClick(e, "custEv_blogAudioPause", "pause");
|
|
483
|
+
};
|
|
484
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
@import "
|
|
2
|
-
@import "
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
@import "dxHelpers/text";
|
|
3
3
|
|
|
4
4
|
.container {
|
|
5
5
|
--primary-color: var(--dx-g-cloud-blue-vibrant-50);
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
|
|
43
43
|
.container dx-icon {
|
|
44
44
|
margin-right: var(--dx-g-spacing-sm);
|
|
45
|
-
margin-top:var(
|
|
45
|
+
margin-top: var(--dx-g-spacing-2xs);
|
|
46
46
|
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
|
+
import { setContainerInnerHtml } from "dxUtils/lwc";
|
|
2
3
|
|
|
3
4
|
export default class Banner extends LightningElement {
|
|
4
5
|
@api bannerMarkup =
|
|
5
6
|
'<span><a href="https://forms.gle/TdSyKFPHXoBx7seM9" target="blank">Share your feedback</a>about our new site.</span>';
|
|
6
7
|
|
|
7
|
-
renderedCallback(){
|
|
8
|
+
renderedCallback() {
|
|
8
9
|
const container = this.template.querySelector(".info-container");
|
|
9
|
-
|
|
10
|
-
// eslint-disable-next-line @lwc/lwc/no-inner-html
|
|
11
|
-
container.innerHTML = this.bannerMarkup
|
|
12
|
-
}
|
|
10
|
+
setContainerInnerHtml(container!, this.bannerMarkup);
|
|
13
11
|
}
|
|
14
12
|
}
|
|
@@ -33,7 +33,7 @@ export default class BrandThemeProvider extends LightningElement {
|
|
|
33
33
|
let style = this.template.querySelector("style");
|
|
34
34
|
if (!style) {
|
|
35
35
|
style = document.createElement("style");
|
|
36
|
-
this.template.appendChild(style);
|
|
36
|
+
(this.template as any).appendChild(style);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
if (style.firstChild) {
|