@zonsh/ui 0.4.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +639 -0
- package/README.md +49 -21
- package/dist/brand.d.ts +3 -0
- package/dist/brand.js +7 -0
- package/dist/components/_breadcrumb-more.d.ts +6 -0
- package/dist/components/_breadcrumb-more.js +5 -0
- package/dist/components/_drawing-svg.d.ts +11 -0
- package/dist/components/_drawing-svg.js +30 -0
- package/dist/components/_media.d.ts +159 -0
- package/dist/components/_media.js +266 -0
- package/dist/components/_overlay.d.ts +8 -5
- package/dist/components/_overlay.js +11 -6
- package/dist/components/_scheduler-calendar.d.ts +71 -0
- package/dist/components/_scheduler-calendar.js +940 -0
- package/dist/components/_scheduler-editor.d.ts +29 -0
- package/dist/components/_scheduler-editor.js +111 -0
- package/dist/components/_scheduler-menu.d.ts +16 -0
- package/dist/components/_scheduler-menu.js +18 -0
- package/dist/components/_scheduler-parts.d.ts +164 -0
- package/dist/components/_scheduler-parts.js +327 -0
- package/dist/components/_suggest-list.d.ts +142 -0
- package/dist/components/_suggest-list.js +159 -0
- package/dist/components/_toolbar-more.d.ts +24 -0
- package/dist/components/_toolbar-more.js +25 -0
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/accordion.js +7 -7
- package/dist/components/action-sheet.d.ts +88 -0
- package/dist/components/action-sheet.js +124 -0
- package/dist/components/alert-dialog.js +3 -1
- package/dist/components/alert.d.ts +11 -18
- package/dist/components/alert.js +9 -6
- package/dist/components/app-bar.d.ts +93 -0
- package/dist/components/app-bar.js +175 -0
- package/dist/components/ascii-field.js +2 -1
- package/dist/components/audio-player.d.ts +134 -0
- package/dist/components/audio-player.js +618 -0
- package/dist/components/avatar.d.ts +6 -6
- package/dist/components/avatar.js +13 -11
- package/dist/components/badge.d.ts +12 -12
- package/dist/components/badge.js +7 -5
- package/dist/components/bottom-nav.d.ts +53 -11
- package/dist/components/bottom-nav.js +389 -24
- package/dist/components/breadcrumb.d.ts +11 -2
- package/dist/components/breadcrumb.js +60 -6
- package/dist/components/button-group.js +5 -1
- package/dist/components/button.d.ts +23 -6
- package/dist/components/button.js +64 -8
- package/dist/components/calendar.js +8 -6
- package/dist/components/card.d.ts +10 -8
- package/dist/components/card.js +15 -14
- package/dist/components/carousel.d.ts +2 -2
- package/dist/components/carousel.js +21 -8
- package/dist/components/chart.d.ts +38 -1
- package/dist/components/chart.js +27 -5
- package/dist/components/checkbox.js +2 -2
- package/dist/components/code-block.d.ts +9 -2
- package/dist/components/code-block.js +26 -7
- package/dist/components/collapsible.js +4 -4
- package/dist/components/color-picker.d.ts +2 -2
- package/dist/components/color-picker.js +5 -5
- package/dist/components/combobox.d.ts +26 -7
- package/dist/components/combobox.js +32 -13
- package/dist/components/command.d.ts +29 -5
- package/dist/components/command.js +37 -12
- package/dist/components/context-menu.d.ts +5 -2
- package/dist/components/context-menu.js +24 -3
- package/dist/components/conversation.d.ts +1 -1
- package/dist/components/conversation.js +77 -16
- package/dist/components/copy-button.d.ts +1 -1
- package/dist/components/copy-button.js +8 -6
- package/dist/components/data-table.d.ts +6 -6
- package/dist/components/data-table.js +41 -15
- package/dist/components/date-picker.d.ts +31 -9
- package/dist/components/date-picker.js +100 -18
- package/dist/components/dialog.d.ts +17 -10
- package/dist/components/dialog.js +20 -13
- package/dist/components/drawer.d.ts +26 -8
- package/dist/components/drawer.js +75 -16
- package/dist/components/drawing.d.ts +25 -0
- package/dist/components/drawing.js +32 -0
- package/dist/components/empty.js +2 -2
- package/dist/components/feature-list.d.ts +65 -13
- package/dist/components/feature-list.js +116 -15
- package/dist/components/field.js +2 -2
- package/dist/components/file-drop.d.ts +9 -7
- package/dist/components/file-drop.js +8 -43
- package/dist/components/filter-bar.d.ts +10 -9
- package/dist/components/filter-bar.js +42 -25
- package/dist/components/graph.d.ts +19 -3
- package/dist/components/graph.js +190 -28
- package/dist/components/illustration.js +53 -31
- package/dist/components/input-group.d.ts +6 -11
- package/dist/components/input-group.js +21 -19
- package/dist/components/input.d.ts +2 -2
- package/dist/components/input.js +3 -3
- package/dist/components/item.d.ts +9 -6
- package/dist/components/item.js +13 -8
- package/dist/components/kbd.d.ts +1 -1
- package/dist/components/kbd.js +1 -1
- package/dist/components/layout.d.ts +2 -1
- package/dist/components/layout.js +55 -11
- package/dist/components/lightbox.d.ts +76 -9
- package/dist/components/lightbox.js +354 -48
- package/dist/components/locale.d.ts +6 -6
- package/dist/components/logo.d.ts +21 -1
- package/dist/components/logo.js +32 -2
- package/dist/components/markdown-editor.d.ts +275 -0
- package/dist/components/markdown-editor.js +831 -0
- package/dist/components/mentions.d.ts +153 -0
- package/dist/components/mentions.js +507 -0
- package/dist/components/menu.d.ts +2 -1
- package/dist/components/menu.js +5 -4
- package/dist/components/menubar.d.ts +23 -5
- package/dist/components/menubar.js +153 -31
- package/dist/components/message.d.ts +62 -11
- package/dist/components/message.js +51 -14
- package/dist/components/meter.js +1 -1
- package/dist/components/money-input.d.ts +1 -1
- package/dist/components/money-input.js +1 -1
- package/dist/components/native-select.d.ts +2 -2
- package/dist/components/native-select.js +4 -4
- package/dist/components/navigation-menu.d.ts +3 -1
- package/dist/components/navigation-menu.js +23 -10
- package/dist/components/number-field.d.ts +2 -9
- package/dist/components/number-field.js +90 -26
- package/dist/components/number-roll.d.ts +26 -0
- package/dist/components/number-roll.js +81 -0
- package/dist/components/otp-field.d.ts +1 -1
- package/dist/components/otp-field.js +24 -3
- package/dist/components/pagination.d.ts +11 -3
- package/dist/components/pagination.js +59 -13
- package/dist/components/pdf-viewer.d.ts +1 -1
- package/dist/components/pdf-viewer.js +8 -8
- package/dist/components/phone-input.d.ts +1 -1
- package/dist/components/phone-input.js +2 -2
- package/dist/components/popover.js +5 -3
- package/dist/components/preview-card.d.ts +37 -2
- package/dist/components/preview-card.js +226 -2
- package/dist/components/progress.js +1 -1
- package/dist/components/prompt-input.d.ts +1 -1
- package/dist/components/prompt-input.js +35 -17
- package/dist/components/pull-to-refresh.d.ts +50 -0
- package/dist/components/pull-to-refresh.js +189 -0
- package/dist/components/quote.d.ts +6 -1
- package/dist/components/quote.js +3 -2
- package/dist/components/radio-group.js +8 -3
- package/dist/components/rating.d.ts +4 -1
- package/dist/components/rating.js +131 -10
- package/dist/components/reasoning.d.ts +1 -1
- package/dist/components/reasoning.js +7 -3
- package/dist/components/resizable.d.ts +1 -1
- package/dist/components/resizable.js +2 -2
- package/dist/components/response.d.ts +4 -3
- package/dist/components/response.js +39 -15
- package/dist/components/scheduler.d.ts +352 -0
- package/dist/components/scheduler.js +1717 -0
- package/dist/components/scroll-area.js +1 -1
- package/dist/components/select.d.ts +17 -4
- package/dist/components/select.js +140 -9
- package/dist/components/separator.d.ts +1 -1
- package/dist/components/separator.js +3 -3
- package/dist/components/sidebar.d.ts +44 -3
- package/dist/components/sidebar.js +90 -31
- package/dist/components/site-header.d.ts +18 -13
- package/dist/components/site-header.js +26 -9
- package/dist/components/skeleton.d.ts +18 -8
- package/dist/components/skeleton.js +23 -8
- package/dist/components/slider.js +2 -2
- package/dist/components/sortable.d.ts +55 -4
- package/dist/components/sortable.js +187 -94
- package/dist/components/sources.d.ts +1 -1
- package/dist/components/sources.js +2 -2
- package/dist/components/spinner.d.ts +4 -4
- package/dist/components/spinner.js +4 -4
- package/dist/components/stat.d.ts +21 -4
- package/dist/components/stat.js +17 -8
- package/dist/components/stepper.d.ts +1 -1
- package/dist/components/stepper.js +8 -7
- package/dist/components/suggestions.d.ts +11 -3
- package/dist/components/suggestions.js +10 -4
- package/dist/components/swipe-actions.d.ts +66 -0
- package/dist/components/swipe-actions.js +292 -0
- package/dist/components/switch.js +1 -1
- package/dist/components/table.d.ts +13 -7
- package/dist/components/table.js +124 -23
- package/dist/components/tabs.js +15 -8
- package/dist/components/tag.d.ts +19 -20
- package/dist/components/tag.js +9 -5
- package/dist/components/tags-input.d.ts +2 -7
- package/dist/components/tags-input.js +11 -8
- package/dist/components/textarea.d.ts +3 -2
- package/dist/components/textarea.js +4 -3
- package/dist/components/theme.d.ts +50 -7
- package/dist/components/theme.js +168 -12
- package/dist/components/time-field.d.ts +6 -10
- package/dist/components/time-field.js +19 -9
- package/dist/components/timeline.d.ts +19 -3
- package/dist/components/timeline.js +21 -9
- package/dist/components/tippy.d.ts +17 -1
- package/dist/components/tippy.js +95 -15
- package/dist/components/toast.d.ts +2 -7
- package/dist/components/toast.js +12 -8
- package/dist/components/toggle-group.d.ts +7 -1
- package/dist/components/toggle-group.js +17 -5
- package/dist/components/toggle.d.ts +2 -2
- package/dist/components/toggle.js +3 -2
- package/dist/components/tool-call.d.ts +1 -1
- package/dist/components/tool-call.js +8 -3
- package/dist/components/toolbar.d.ts +57 -4
- package/dist/components/toolbar.js +219 -16
- package/dist/components/tooltip.d.ts +5 -3
- package/dist/components/tooltip.js +14 -6
- package/dist/components/tour.d.ts +1 -1
- package/dist/components/tour.js +70 -24
- package/dist/components/tree.js +33 -10
- package/dist/components/typography.d.ts +31 -8
- package/dist/components/typography.js +21 -10
- package/dist/components/video-player.d.ts +7 -2
- package/dist/components/video-player.js +182 -225
- package/dist/index.d.ts +99 -92
- package/dist/index.js +99 -92
- package/dist/lib/calendar.d.ts +153 -0
- package/dist/lib/calendar.js +312 -0
- package/dist/lib/cn.d.ts +3 -1
- package/dist/lib/cn.js +5 -0
- package/dist/lib/code-highlight.d.ts +14 -0
- package/dist/lib/code-highlight.js +81 -18
- package/dist/lib/drag.d.ts +39 -0
- package/dist/lib/drag.js +96 -0
- package/dist/lib/editorial-assets.js +16 -8
- package/dist/lib/figure/figures/automation.js +25 -6
- package/dist/lib/figure/figures/bar-chart.js +6 -1
- package/dist/lib/figure/figures/brackets-classic.js +4 -1
- package/dist/lib/figure/figures/city.js +12 -2
- package/dist/lib/figure/figures/conveyor.js +17 -4
- package/dist/lib/figure/figures/database.js +5 -2
- package/dist/lib/figure/figures/documents.js +11 -3
- package/dist/lib/figure/figures/inbox.js +5 -2
- package/dist/lib/figure/figures/laptop.js +3 -1
- package/dist/lib/figure/figures/pipeline.js +45 -10
- package/dist/lib/figure/figures/platform.js +62 -7
- package/dist/lib/figure/figures/server.js +21 -5
- package/dist/lib/figure/figures/spreadsheet.js +29 -5
- package/dist/lib/figure/kernel.d.ts +4 -2
- package/dist/lib/figure/kernel.js +10 -5
- package/dist/lib/figure/parts.js +6 -2
- package/dist/lib/files.d.ts +31 -0
- package/dist/lib/files.js +60 -0
- package/dist/lib/gesture.d.ts +70 -0
- package/dist/lib/gesture.js +141 -0
- package/dist/lib/glide.d.ts +10 -4
- package/dist/lib/glide.js +14 -5
- package/dist/lib/icons.d.ts +1 -0
- package/dist/lib/icons.js +6 -0
- package/dist/lib/illustration-library.js +1 -6
- package/dist/lib/markdown-edit.d.ts +112 -0
- package/dist/lib/markdown-edit.js +557 -0
- package/dist/lib/markdown-rich-editor.d.ts +188 -0
- package/dist/lib/markdown-rich-editor.js +1153 -0
- package/dist/lib/markdown-rich.d.ts +63 -0
- package/dist/lib/markdown-rich.js +534 -0
- package/dist/lib/mentions.d.ts +100 -0
- package/dist/lib/mentions.js +246 -0
- package/dist/lib/motion.d.ts +18 -0
- package/dist/lib/motion.js +43 -5
- package/dist/lib/number-roll.d.ts +89 -0
- package/dist/lib/number-roll.js +391 -0
- package/dist/lib/platform.d.ts +6 -0
- package/dist/lib/platform.js +14 -0
- package/dist/lib/portal-container.d.ts +9 -0
- package/dist/lib/portal-container.js +10 -0
- package/dist/lib/press.d.ts +5 -0
- package/dist/lib/press.js +186 -0
- package/dist/lib/scheduler.d.ts +128 -0
- package/dist/lib/scheduler.js +272 -0
- package/dist/lib/scroll-edges.d.ts +9 -0
- package/dist/lib/scroll-edges.js +50 -0
- package/dist/lib/table-fit.d.ts +4 -3
- package/dist/lib/table-fit.js +92 -25
- package/dist/lib/theme-preset.d.ts +267 -0
- package/dist/lib/theme-preset.js +1046 -0
- package/dist/lib/theme-script.d.ts +23 -3
- package/dist/lib/theme-script.js +17 -5
- package/dist/lib/tippy/sprite.d.ts +36 -4
- package/dist/lib/tippy/sprite.js +188 -15
- package/dist/lib/tone.d.ts +4 -0
- package/dist/lib/tone.js +1 -0
- package/dist/messages/de.d.ts +3 -3
- package/dist/messages/de.js +274 -3
- package/dist/skills/zon-ui/SKILL.md +279 -0
- package/dist/skills/zon-ui/references/authoring.md +265 -0
- package/dist/skills/zon-ui/references/brand.md +416 -0
- package/dist/skills/zon-ui/references/components/accordion.md +199 -0
- package/dist/skills/zon-ui/references/components/action-sheet.md +268 -0
- package/dist/skills/zon-ui/references/components/alert-dialog.md +276 -0
- package/dist/skills/zon-ui/references/components/alert.md +167 -0
- package/dist/skills/zon-ui/references/components/app-bar.md +307 -0
- package/dist/skills/zon-ui/references/components/ascii-field.md +121 -0
- package/dist/skills/zon-ui/references/components/aspect-ratio.md +112 -0
- package/dist/skills/zon-ui/references/components/audio-player.md +231 -0
- package/dist/skills/zon-ui/references/components/avatar.md +98 -0
- package/dist/skills/zon-ui/references/components/badge.md +227 -0
- package/dist/skills/zon-ui/references/components/bottom-nav.md +709 -0
- package/dist/skills/zon-ui/references/components/breadcrumb.md +143 -0
- package/dist/skills/zon-ui/references/components/button-group.md +216 -0
- package/dist/skills/zon-ui/references/components/button.md +309 -0
- package/dist/skills/zon-ui/references/components/calendar.md +296 -0
- package/dist/skills/zon-ui/references/components/card.md +158 -0
- package/dist/skills/zon-ui/references/components/carousel.md +297 -0
- package/dist/skills/zon-ui/references/components/chart.md +739 -0
- package/dist/skills/zon-ui/references/components/chat.md +417 -0
- package/dist/skills/zon-ui/references/components/checkbox.md +219 -0
- package/dist/skills/zon-ui/references/components/code-block.md +143 -0
- package/dist/skills/zon-ui/references/components/code-highlight.md +118 -0
- package/dist/skills/zon-ui/references/components/collapsible.md +146 -0
- package/dist/skills/zon-ui/references/components/color-picker.md +200 -0
- package/dist/skills/zon-ui/references/components/combobox.md +455 -0
- package/dist/skills/zon-ui/references/components/command.md +326 -0
- package/dist/skills/zon-ui/references/components/contact-form.md +562 -0
- package/dist/skills/zon-ui/references/components/context-menu.md +159 -0
- package/dist/skills/zon-ui/references/components/conversation.md +146 -0
- package/dist/skills/zon-ui/references/components/copy-button.md +162 -0
- package/dist/skills/zon-ui/references/components/crm.md +1022 -0
- package/dist/skills/zon-ui/references/components/dashboard.md +612 -0
- package/dist/skills/zon-ui/references/components/data-table.md +776 -0
- package/dist/skills/zon-ui/references/components/date-picker.md +444 -0
- package/dist/skills/zon-ui/references/components/dialog.md +335 -0
- package/dist/skills/zon-ui/references/components/direction.md +165 -0
- package/dist/skills/zon-ui/references/components/drawer.md +276 -0
- package/dist/skills/zon-ui/references/components/drawing.md +94 -0
- package/dist/skills/zon-ui/references/components/empty.md +225 -0
- package/dist/skills/zon-ui/references/components/feature-list.md +412 -0
- package/dist/skills/zon-ui/references/components/field.md +209 -0
- package/dist/skills/zon-ui/references/components/file-drop.md +234 -0
- package/dist/skills/zon-ui/references/components/filter-bar.md +485 -0
- package/dist/skills/zon-ui/references/components/form.md +970 -0
- package/dist/skills/zon-ui/references/components/graph.md +339 -0
- package/dist/skills/zon-ui/references/components/illustration.md +497 -0
- package/dist/skills/zon-ui/references/components/inbox.md +263 -0
- package/dist/skills/zon-ui/references/components/input-group.md +339 -0
- package/dist/skills/zon-ui/references/components/input.md +189 -0
- package/dist/skills/zon-ui/references/components/item.md +277 -0
- package/dist/skills/zon-ui/references/components/kanban.md +626 -0
- package/dist/skills/zon-ui/references/components/kbd.md +116 -0
- package/dist/skills/zon-ui/references/components/label.md +104 -0
- package/dist/skills/zon-ui/references/components/layout.md +291 -0
- package/dist/skills/zon-ui/references/components/lightbox.md +235 -0
- package/dist/skills/zon-ui/references/components/locale.md +279 -0
- package/dist/skills/zon-ui/references/components/logo.md +257 -0
- package/dist/skills/zon-ui/references/components/markdown-editor.md +558 -0
- package/dist/skills/zon-ui/references/components/mentions.md +512 -0
- package/dist/skills/zon-ui/references/components/menu.md +218 -0
- package/dist/skills/zon-ui/references/components/menubar.md +292 -0
- package/dist/skills/zon-ui/references/components/message.md +243 -0
- package/dist/skills/zon-ui/references/components/meter.md +105 -0
- package/dist/skills/zon-ui/references/components/money-input.md +333 -0
- package/dist/skills/zon-ui/references/components/native-select.md +197 -0
- package/dist/skills/zon-ui/references/components/navigation-menu.md +253 -0
- package/dist/skills/zon-ui/references/components/number-field.md +210 -0
- package/dist/skills/zon-ui/references/components/number-roll.md +175 -0
- package/dist/skills/zon-ui/references/components/onboarding.md +896 -0
- package/dist/skills/zon-ui/references/components/otp-field.md +166 -0
- package/dist/skills/zon-ui/references/components/pagination.md +109 -0
- package/dist/skills/zon-ui/references/components/pdf-viewer.md +177 -0
- package/dist/skills/zon-ui/references/components/phone-input.md +252 -0
- package/dist/skills/zon-ui/references/components/popover.md +176 -0
- package/dist/skills/zon-ui/references/components/preview-card.md +193 -0
- package/dist/skills/zon-ui/references/components/pricing.md +724 -0
- package/dist/skills/zon-ui/references/components/progress.md +92 -0
- package/dist/skills/zon-ui/references/components/prompt-input.md +307 -0
- package/dist/skills/zon-ui/references/components/pull-to-refresh.md +188 -0
- package/dist/skills/zon-ui/references/components/quote.md +115 -0
- package/dist/skills/zon-ui/references/components/radio-group.md +215 -0
- package/dist/skills/zon-ui/references/components/rating.md +260 -0
- package/dist/skills/zon-ui/references/components/reasoning.md +102 -0
- package/dist/skills/zon-ui/references/components/resizable.md +213 -0
- package/dist/skills/zon-ui/references/components/response.md +170 -0
- package/dist/skills/zon-ui/references/components/scheduler.md +732 -0
- package/dist/skills/zon-ui/references/components/scroll-area.md +122 -0
- package/dist/skills/zon-ui/references/components/select.md +351 -0
- package/dist/skills/zon-ui/references/components/separator.md +103 -0
- package/dist/skills/zon-ui/references/components/settings.md +793 -0
- package/dist/skills/zon-ui/references/components/shop.md +1715 -0
- package/dist/skills/zon-ui/references/components/sidebar.md +813 -0
- package/dist/skills/zon-ui/references/components/sign-in.md +1639 -0
- package/dist/skills/zon-ui/references/components/site-header.md +303 -0
- package/dist/skills/zon-ui/references/components/skeleton.md +256 -0
- package/dist/skills/zon-ui/references/components/slider.md +172 -0
- package/dist/skills/zon-ui/references/components/sortable.md +405 -0
- package/dist/skills/zon-ui/references/components/sources.md +106 -0
- package/dist/skills/zon-ui/references/components/spinner.md +222 -0
- package/dist/skills/zon-ui/references/components/stat.md +267 -0
- package/dist/skills/zon-ui/references/components/stepper.md +285 -0
- package/dist/skills/zon-ui/references/components/suggestions.md +146 -0
- package/dist/skills/zon-ui/references/components/swipe-actions.md +344 -0
- package/dist/skills/zon-ui/references/components/switch.md +160 -0
- package/dist/skills/zon-ui/references/components/table.md +999 -0
- package/dist/skills/zon-ui/references/components/tabs.md +258 -0
- package/dist/skills/zon-ui/references/components/tag.md +115 -0
- package/dist/skills/zon-ui/references/components/tags-input.md +216 -0
- package/dist/skills/zon-ui/references/components/textarea.md +95 -0
- package/dist/skills/zon-ui/references/components/theme-editor.md +3940 -0
- package/dist/skills/zon-ui/references/components/theme.md +362 -0
- package/dist/skills/zon-ui/references/components/time-field.md +222 -0
- package/dist/skills/zon-ui/references/components/timeline.md +285 -0
- package/dist/skills/zon-ui/references/components/tippy.md +243 -0
- package/dist/skills/zon-ui/references/components/toast.md +220 -0
- package/dist/skills/zon-ui/references/components/toggle-group.md +261 -0
- package/dist/skills/zon-ui/references/components/toggle.md +167 -0
- package/dist/skills/zon-ui/references/components/tool-call.md +146 -0
- package/dist/skills/zon-ui/references/components/toolbar.md +260 -0
- package/dist/skills/zon-ui/references/components/tooltip.md +172 -0
- package/dist/skills/zon-ui/references/components/tour.md +423 -0
- package/dist/skills/zon-ui/references/components/tree.md +481 -0
- package/dist/skills/zon-ui/references/components/typography.md +347 -0
- package/dist/skills/zon-ui/references/components/video-player.md +386 -0
- package/dist/skills/zon-ui/references/marketing.md +467 -0
- package/dist/skills/zon-ui/references/motion.md +455 -0
- package/dist/skills/zon-ui/references/recipes.md +1232 -0
- package/dist/skills/zon-ui/references/tokens.md +866 -0
- package/dist/sources/accordion.css +4 -0
- package/dist/sources/action-sheet.css +11 -0
- package/dist/sources/alert-dialog.css +6 -0
- package/dist/sources/alert.css +3 -0
- package/dist/sources/app-bar.css +14 -0
- package/dist/sources/ascii-field.css +3 -0
- package/dist/sources/aspect-ratio.css +3 -0
- package/dist/sources/audio-player.css +20 -0
- package/dist/sources/avatar.css +3 -0
- package/dist/sources/badge.css +3 -0
- package/dist/sources/bottom-nav.css +9 -0
- package/dist/sources/breadcrumb.css +14 -0
- package/dist/sources/button-group.css +3 -0
- package/dist/sources/button.css +9 -0
- package/dist/sources/calendar.css +13 -0
- package/dist/sources/card.css +3 -0
- package/dist/sources/carousel.css +11 -0
- package/dist/sources/chart.css +5 -0
- package/dist/sources/checkbox.css +6 -0
- package/dist/sources/code-block.css +13 -0
- package/dist/sources/collapsible.css +4 -0
- package/dist/sources/color-picker.css +13 -0
- package/dist/sources/combobox.css +13 -0
- package/dist/sources/command.css +13 -0
- package/dist/sources/context-menu.css +12 -0
- package/dist/sources/conversation.css +10 -0
- package/dist/sources/copy-button.css +10 -0
- package/dist/sources/data-table.css +27 -0
- package/dist/sources/date-picker.css +20 -0
- package/dist/sources/dialog.css +9 -0
- package/dist/sources/direction.css +2 -0
- package/dist/sources/drawer.css +9 -0
- package/dist/sources/drawing.css +5 -0
- package/dist/sources/empty.css +3 -0
- package/dist/sources/feature-list.css +4 -0
- package/dist/sources/field.css +4 -0
- package/dist/sources/file-drop.css +15 -0
- package/dist/sources/filter-bar.css +30 -0
- package/dist/sources/form.css +4 -0
- package/dist/sources/graph.css +19 -0
- package/dist/sources/illustration.css +28 -0
- package/dist/sources/input-group.css +7 -0
- package/dist/sources/input.css +3 -0
- package/dist/sources/item.css +4 -0
- package/dist/sources/kbd.css +5 -0
- package/dist/sources/label.css +3 -0
- package/dist/sources/layout.css +3 -0
- package/dist/sources/lightbox.css +33 -0
- package/dist/sources/locale.css +2 -0
- package/dist/sources/logo.css +4 -0
- package/dist/sources/markdown-editor.css +41 -0
- package/dist/sources/mentions.css +13 -0
- package/dist/sources/menu.css +11 -0
- package/dist/sources/menubar.css +14 -0
- package/dist/sources/message.css +16 -0
- package/dist/sources/meter.css +4 -0
- package/dist/sources/money-input.css +10 -0
- package/dist/sources/native-select.css +4 -0
- package/dist/sources/navigation-menu.css +8 -0
- package/dist/sources/number-field.css +8 -0
- package/dist/sources/number-roll.css +6 -0
- package/dist/sources/otp-field.css +5 -0
- package/dist/sources/pagination.css +11 -0
- package/dist/sources/pdf-viewer.css +30 -0
- package/dist/sources/phone-input.css +20 -0
- package/dist/sources/popover.css +7 -0
- package/dist/sources/preview-card.css +7 -0
- package/dist/sources/progress.css +4 -0
- package/dist/sources/prompt-input.css +15 -0
- package/dist/sources/pull-to-refresh.css +14 -0
- package/dist/sources/quote.css +3 -0
- package/dist/sources/radio-group.css +5 -0
- package/dist/sources/rating.css +6 -0
- package/dist/sources/reasoning.css +6 -0
- package/dist/sources/resizable.css +4 -0
- package/dist/sources/response.css +16 -0
- package/dist/sources/scheduler.css +44 -0
- package/dist/sources/scroll-area.css +3 -0
- package/dist/sources/select.css +12 -0
- package/dist/sources/separator.css +3 -0
- package/dist/sources/sidebar.css +19 -0
- package/dist/sources/site-header.css +15 -0
- package/dist/sources/skeleton.css +3 -0
- package/dist/sources/slider.css +6 -0
- package/dist/sources/sortable.css +12 -0
- package/dist/sources/sources.css +6 -0
- package/dist/sources/spinner.css +6 -0
- package/dist/sources/stat.css +9 -0
- package/dist/sources/stepper.css +6 -0
- package/dist/sources/suggestions.css +10 -0
- package/dist/sources/swipe-actions.css +20 -0
- package/dist/sources/switch.css +5 -0
- package/dist/sources/table.css +7 -0
- package/dist/sources/tabs.css +5 -0
- package/dist/sources/tag.css +3 -0
- package/dist/sources/tags-input.css +6 -0
- package/dist/sources/textarea.css +3 -0
- package/dist/sources/theme.css +13 -0
- package/dist/sources/time-field.css +7 -0
- package/dist/sources/timeline.css +7 -0
- package/dist/sources/tippy.css +6 -0
- package/dist/sources/toast.css +6 -0
- package/dist/sources/toggle-group.css +5 -0
- package/dist/sources/toggle.css +3 -0
- package/dist/sources/tool-call.css +16 -0
- package/dist/sources/toolbar.css +14 -0
- package/dist/sources/tooltip.css +6 -0
- package/dist/sources/tour.css +14 -0
- package/dist/sources/tree.css +6 -0
- package/dist/sources/typography.css +4 -0
- package/dist/sources/video-player.css +21 -0
- package/dist/styles/ai.css +3 -0
- package/dist/styles/brand.css +98 -0
- package/dist/styles/core.css +266 -0
- package/dist/styles/editor.css +3 -0
- package/dist/styles/expressive.css +75 -77
- package/dist/styles/fonts.css +61 -117
- package/dist/styles/graph.css +4 -0
- package/dist/styles/illustration.css +4 -0
- package/dist/styles/index.css +11 -193
- package/dist/styles/material.css +177 -31
- package/dist/styles/parts/ai.css +20 -14
- package/dist/styles/parts/brand.css +2 -2
- package/dist/styles/parts/controls.css +51 -38
- package/dist/styles/parts/data.css +43 -11
- package/dist/styles/parts/editor.css +372 -0
- package/dist/styles/parts/feedback.css +75 -15
- package/dist/styles/parts/foundations.css +12 -7
- package/dist/styles/parts/graph.css +25 -9
- package/dist/styles/parts/inputs.css +172 -9
- package/dist/styles/parts/isometric.css +6 -5
- package/dist/styles/parts/navigation.css +237 -25
- package/dist/styles/parts/overlays.css +110 -8
- package/dist/styles/parts/pdf.css +15 -9
- package/dist/styles/pdf.css +3 -0
- package/dist/styles/prose.css +3 -0
- package/dist/styles/tokens.css +105 -15
- package/dist/theme.d.ts +1 -0
- package/dist/theme.js +5 -0
- package/dist/vite.d.ts +48 -59
- package/dist/vite.js +54 -21
- package/package.json +69 -2
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import { AirplayIcon, ArrowLeftIcon, AudioLinesIcon, CaptionsIcon, CaptionsOffIcon, ChevronLeftIcon, ChevronsLeftIcon, ChevronsRightIcon, GalleryVerticalEndIcon, LanguagesIcon, MaximizeIcon, MinimizeIcon, PauseIcon, PictureInPicture2Icon, PlayIcon, RotateCcwIcon, RotateCwIcon, SkipForwardIcon, VideoOffIcon, Volume1Icon, Volume2Icon, VolumeXIcon, } from "lucide-react";
|
|
3
|
+
import { AirplayIcon, ArrowLeftIcon, AudioLinesIcon, CaptionsIcon, CaptionsOffIcon, ChevronLeftIcon, ChevronsLeftIcon, ChevronsRightIcon, GalleryVerticalEndIcon, LanguagesIcon, MaximizeIcon, MinimizeIcon, PauseIcon, PictureInPicture2Icon, PlayIcon, RotateCcwIcon, RotateCwIcon, SkipForwardIcon, VideoOffIcon, } from "../lib/icons.js";
|
|
5
4
|
import * as React from "react";
|
|
6
5
|
import { cn } from "../lib/cn.js";
|
|
7
6
|
import { mergeRefs } from "../lib/merge-refs.js";
|
|
7
|
+
import { cssDuration, cssEase, cssTime } from "../lib/motion.js";
|
|
8
|
+
import { ChoiceMenu as MediaChoiceMenu, createPlayhead, atEnd, audible, bufferedEnd, DEFAULT_SPEEDS, formatTime, hushOthers, MediaClock, MediaControl, MediaScrubber, MediaVolume, readVolume, soundPlayers, TIME_STEP, usePlayhead, writeVolume, } from "./_media.js";
|
|
8
9
|
import { Button } from "./button.js";
|
|
9
|
-
import { DirectionProvider } from "./direction.js";
|
|
10
10
|
import { Menu, MenuContent, MenuGroup, MenuGroupLabel, MenuItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuTrigger, } from "./menu.js";
|
|
11
|
+
import { useMessages } from "./locale.js";
|
|
11
12
|
import { Skeleton } from "./skeleton.js";
|
|
12
13
|
import { Spinner } from "./spinner.js";
|
|
13
14
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.js";
|
|
@@ -66,48 +67,47 @@ const playerVariants = {
|
|
|
66
67
|
card: "rounded-card surface-card [--card-padding:0]",
|
|
67
68
|
plain: "",
|
|
68
69
|
};
|
|
69
|
-
const DEFAULT_SPEEDS = [0.5, 0.75, 1, 1.25, 1.5, 2];
|
|
70
70
|
/** How long the controls stay after the pointer or keyboard was last used, while playing. */
|
|
71
71
|
const IDLE_MS = 2500;
|
|
72
72
|
/** How far the movie layout's skip buttons jump, in seconds. */
|
|
73
73
|
const SKIP = 10;
|
|
74
74
|
/** From this frame width the movie layout's controls grow to the prominent size. */
|
|
75
75
|
const LARGE_FRAME = 768;
|
|
76
|
-
/**
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const FLASH_MS = 300;
|
|
76
|
+
/**
|
|
77
|
+
* Below this frame width (a phone held upright) the movie layout is too short for the title, the
|
|
78
|
+
* middle button, a subtitle and a skip beside the controls: they stack instead (see `narrow`).
|
|
79
|
+
*/
|
|
80
|
+
const NARROW_FRAME = 576;
|
|
82
81
|
/** The last moment of a segment that still offers its skip, so it doesn't flash at the cut. */
|
|
83
82
|
const SEGMENT_TAIL = 0.5;
|
|
84
83
|
/** How long a skip stays on its own, in seconds of playback; after that it shows with the controls. */
|
|
85
84
|
const SEGMENT_PROMPT = 15;
|
|
86
85
|
/** An automatic skip's countdown, in seconds of playback. */
|
|
87
86
|
const AUTO_COUNTDOWN = 10;
|
|
88
|
-
/** How far the playhead moves before the controls show its new time (s): often enough for the eye, not every frame. */
|
|
89
|
-
const TIME_STEP = 0.1;
|
|
90
|
-
/** The scrubber's step (s). Its last value rounds to a step, so a drag to the end may land up to half a step short. */
|
|
91
|
-
const SCRUB_STEP = 0.1;
|
|
92
87
|
/** A click on the picture this soon after a menu closed only closed the menu (ms). */
|
|
93
88
|
const MENU_CLOSE_MS = 400;
|
|
94
89
|
/** Two taps this close together are a double tap (ms). */
|
|
95
90
|
const DOUBLE_TAP_MS = 350;
|
|
96
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* A jump's readout ("+20s") stays this long after the last press or tap, so it can be read, and
|
|
93
|
+
* jumps the same way within it add to it (ms). Reading time, not motion: the readout answers the
|
|
94
|
+
* press in --duration and fades out on its own at the end (see `jump` below).
|
|
95
|
+
*/
|
|
97
96
|
const JUMP_MS = 1000;
|
|
97
|
+
/**
|
|
98
|
+
* A stream that stops while it plays loads again by itself after each of these pauses in turn (ms),
|
|
99
|
+
* before the error shows: about half a minute, for a connection or a server that drops out.
|
|
100
|
+
*/
|
|
101
|
+
const RETRY_DELAYS = [1000, 3000, 8000, 15000];
|
|
102
|
+
/** Retries this long after the last one belong to a new dropout, which gets all of them again (ms). */
|
|
103
|
+
const AUTO_RETRY_MS = 60_000;
|
|
104
|
+
/** A stall this long while it should be playing counts as stopped (ms). */
|
|
105
|
+
const STALL_RETRY_MS = 15_000;
|
|
98
106
|
/** A subtitle file still on its way after this long gets a note where the subtitles show (ms). */
|
|
99
107
|
const SUBTITLE_SLOW_MS = 2000;
|
|
100
108
|
/** Asks for a subtitle file, and the pause between them (ms): cutting one out of a whole file can outlast a request. */
|
|
101
109
|
const SUBTITLE_TRIES = 4;
|
|
102
110
|
const SUBTITLE_RETRY_MS = 15_000;
|
|
103
|
-
/** 75 → "1:15", 3725 → "1:02:05". */
|
|
104
|
-
function formatTime(seconds) {
|
|
105
|
-
const s = Number.isFinite(seconds) && seconds > 0 ? Math.floor(seconds) : 0;
|
|
106
|
-
const h = Math.floor(s / 3600);
|
|
107
|
-
const m = Math.floor((s % 3600) / 60);
|
|
108
|
-
const rest = String(s % 60).padStart(2, "0");
|
|
109
|
-
return h > 0 ? `${h}:${String(m).padStart(2, "0")}:${rest}` : `${m}:${rest}`;
|
|
110
|
-
}
|
|
111
111
|
/**
|
|
112
112
|
* A cue's lines as text. Subtitles converted from ASS (most anime) keep its override tags, such
|
|
113
113
|
* as `{\\fad(250,0)\\blur2}`, and its `\\N` breaks; WebVTT itself has neither.
|
|
@@ -120,15 +120,6 @@ function cueLines(text) {
|
|
|
120
120
|
.map((line) => line.trim())
|
|
121
121
|
.filter(Boolean);
|
|
122
122
|
}
|
|
123
|
-
/** The end of the buffered range the playhead is in. */
|
|
124
|
-
function bufferedEnd(video) {
|
|
125
|
-
const { buffered, currentTime } = video;
|
|
126
|
-
for (let i = 0; i < buffered.length; i++) {
|
|
127
|
-
if (buffered.start(i) <= currentTime + 0.5 && currentTime <= buffered.end(i))
|
|
128
|
-
return buffered.end(i);
|
|
129
|
-
}
|
|
130
|
-
return 0;
|
|
131
|
-
}
|
|
132
123
|
/** The distinct values of one field across the versions, in the order they are listed. */
|
|
133
124
|
function choices(versions, field) {
|
|
134
125
|
return [...new Set(versions.map((v) => v[field]).filter((v) => !!v))];
|
|
@@ -146,82 +137,6 @@ const sourceKey = (src) => src === undefined ? "" : typeof src === "string" ? sr
|
|
|
146
137
|
* stream (HLS from a media server) is fetched from its beginning only to seek away again.
|
|
147
138
|
*/
|
|
148
139
|
const startingAt = (src, time) => time > 0 ? `${src.split("#")[0]}#t=${time.toFixed(1)}` : src;
|
|
149
|
-
const PLAYHEAD_START = { time: 0, scrub: null, buffered: 0 };
|
|
150
|
-
/**
|
|
151
|
-
* The playhead, kept outside React state. It moves ten times a second while the video plays, and
|
|
152
|
-
* only the parts that show it (the scrubber, the times, a segment's skip) follow it; the rest of
|
|
153
|
-
* the player doesn't redraw.
|
|
154
|
-
*/
|
|
155
|
-
function createPlayhead() {
|
|
156
|
-
let state = PLAYHEAD_START;
|
|
157
|
-
const listeners = new Set();
|
|
158
|
-
return {
|
|
159
|
-
get: () => state,
|
|
160
|
-
set(next) {
|
|
161
|
-
if (Object.keys(next).every((key) => next[key] === state[key]))
|
|
162
|
-
return;
|
|
163
|
-
state = { ...state, ...next };
|
|
164
|
-
for (const listener of listeners)
|
|
165
|
-
listener();
|
|
166
|
-
},
|
|
167
|
-
subscribe(listener) {
|
|
168
|
-
listeners.add(listener);
|
|
169
|
-
return () => {
|
|
170
|
-
listeners.delete(listener);
|
|
171
|
-
};
|
|
172
|
-
},
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* At the end, or within a scrubber step of it, of a video with a length that doesn't loop: decided
|
|
177
|
-
* by position, since a stream still fetching its last part doesn't know yet that it has ended.
|
|
178
|
-
*/
|
|
179
|
-
const atEnd = (video) => !video.loop && Number.isFinite(video.duration) && video.duration - video.currentTime <= SCRUB_STEP;
|
|
180
|
-
/** The players on the page that play with sound one at a time (`pauseOthers`). */
|
|
181
|
-
const soundPlayers = new Set();
|
|
182
|
-
const audible = (video) => !video.paused && !video.muted && video.volume > 0;
|
|
183
|
-
/** This player started with sound: the others that have sound pause. Muted ones play on. */
|
|
184
|
-
function hushOthers(video) {
|
|
185
|
-
if (!soundPlayers.has(video))
|
|
186
|
-
return;
|
|
187
|
-
for (const other of soundPlayers)
|
|
188
|
-
if (other !== video && audible(other))
|
|
189
|
-
other.pause();
|
|
190
|
-
}
|
|
191
|
-
/** The volume and mute stored under `volumeStorageKey`, when there are any and they're the player's own. */
|
|
192
|
-
function readVolume(key) {
|
|
193
|
-
try {
|
|
194
|
-
const stored = JSON.parse(window.localStorage.getItem(key) ?? "null");
|
|
195
|
-
const { volume, muted } = (stored ?? {});
|
|
196
|
-
return typeof volume === "number" && volume >= 0 && volume <= 1 && typeof muted === "boolean"
|
|
197
|
-
? { volume, muted }
|
|
198
|
-
: null;
|
|
199
|
-
}
|
|
200
|
-
catch {
|
|
201
|
-
// Storage unavailable (private mode, blocked site data), or something else's under that key: the defaults stand.
|
|
202
|
-
return null;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
function writeVolume(key, volume, muted) {
|
|
206
|
-
try {
|
|
207
|
-
window.localStorage.setItem(key, JSON.stringify({ volume, muted }));
|
|
208
|
-
}
|
|
209
|
-
catch {
|
|
210
|
-
// Ignore: remembering is a convenience.
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
/** One value from the playhead: the component redraws when that value changes, not at every tick. */
|
|
214
|
-
function usePlayhead(playhead, select) {
|
|
215
|
-
return React.useSyncExternalStore(playhead.subscribe, () => select(playhead.get()), () => select(PLAYHEAD_START));
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* The track and its thumb, shared by the scrubber and the volume. The same material as `Slider`,
|
|
219
|
-
* and like it in a contrast theme (Windows), which paints fills over with the page colour: the
|
|
220
|
-
* value takes the system highlight and the thumb an edge.
|
|
221
|
-
*/
|
|
222
|
-
const trackClass = "relative h-1.5 w-full rounded-full material-field select-none";
|
|
223
|
-
const indicatorClass = "rounded-full bg-foreground-soft select-none forced-color-adjust-none forced-colors:bg-[Highlight]";
|
|
224
|
-
const thumbClass = cn("size-[18px] rounded-full bg-control-surface bg-linear-to-b from-control-inner-edge to-transparent shadow-thumb select-none forced-colors:border-2", "transition-[background-color,box-shadow] duration-(--duration) ease-brand hover:bg-control-hover data-dragging:bg-control-hover", "has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-0 has-[:focus-visible]:outline-control-focus");
|
|
225
140
|
/**
|
|
226
141
|
* VideoPlayer — a video in the zon material: the picture letterboxed on black, and over it
|
|
227
142
|
* controls set dark whatever the page's theme — play, a scrubber with the buffered range and the
|
|
@@ -248,7 +163,7 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
248
163
|
const pointerFocus = React.useRef(false);
|
|
249
164
|
const video = React.useRef(null);
|
|
250
165
|
const movie = layout === "movie";
|
|
251
|
-
const labels =
|
|
166
|
+
const labels = useMessages("videoPlayer", DEFAULT_LABELS, labelOverrides);
|
|
252
167
|
const [playing, setPlaying] = React.useState(false);
|
|
253
168
|
const [started, setStarted] = React.useState(autoPlay);
|
|
254
169
|
const [ended, setEnded] = React.useState(false);
|
|
@@ -386,6 +301,14 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
386
301
|
const told = React.useRef("pause");
|
|
387
302
|
// A drag on the scrubber holds the playing video still until the thumb is let go: to the app it plays on.
|
|
388
303
|
const holding = React.useRef(false);
|
|
304
|
+
// How many times a stream that dropped has loaded again by itself, and when last (RETRY_DELAYS).
|
|
305
|
+
const retries = React.useRef({
|
|
306
|
+
count: 0,
|
|
307
|
+
at: -Infinity,
|
|
308
|
+
timer: undefined,
|
|
309
|
+
});
|
|
310
|
+
// The latest `retry`, for the video's events (set up once) to call; false where it didn't.
|
|
311
|
+
const autoRetry = React.useRef(() => false);
|
|
389
312
|
// The video can't be played. The controls go, with their menus and without a pointer leaving or a
|
|
390
313
|
// blur: what held them up (an open menu, the pointer, focus) would otherwise hold them up for good.
|
|
391
314
|
const fail = () => {
|
|
@@ -401,6 +324,7 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
401
324
|
return;
|
|
402
325
|
let frame = 0;
|
|
403
326
|
let shownAt = -1;
|
|
327
|
+
let stalled;
|
|
404
328
|
// Each frame would redraw the scrubber sixty times a second; the eye needs far fewer.
|
|
405
329
|
const show = () => {
|
|
406
330
|
const now = el.currentTime;
|
|
@@ -473,9 +397,22 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
473
397
|
callbacks.current.onPause?.();
|
|
474
398
|
},
|
|
475
399
|
seeked: () => playhead.set({ time: el.currentTime, buffered: bufferedEnd(el) }),
|
|
476
|
-
waiting: () =>
|
|
477
|
-
|
|
478
|
-
|
|
400
|
+
waiting: () => {
|
|
401
|
+
setWaiting(true);
|
|
402
|
+
clearTimeout(stalled);
|
|
403
|
+
stalled = setTimeout(() => {
|
|
404
|
+
if (!el.paused && el.readyState < HTMLMediaElement.HAVE_FUTURE_DATA)
|
|
405
|
+
autoRetry.current();
|
|
406
|
+
}, STALL_RETRY_MS);
|
|
407
|
+
},
|
|
408
|
+
playing: () => {
|
|
409
|
+
setWaiting(false);
|
|
410
|
+
clearTimeout(stalled);
|
|
411
|
+
},
|
|
412
|
+
canplay: () => {
|
|
413
|
+
setWaiting(false);
|
|
414
|
+
clearTimeout(stalled);
|
|
415
|
+
},
|
|
479
416
|
ended: () => {
|
|
480
417
|
setPlaying(false);
|
|
481
418
|
setEnded(true);
|
|
@@ -486,7 +423,10 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
486
423
|
callbacks.current.onEnded?.();
|
|
487
424
|
},
|
|
488
425
|
// A `src` that fails; one of several `<source>`s tells its own element (below).
|
|
489
|
-
error:
|
|
426
|
+
error: () => {
|
|
427
|
+
if (!autoRetry.current())
|
|
428
|
+
fail();
|
|
429
|
+
},
|
|
490
430
|
enterpictureinpicture: () => setInPip(true),
|
|
491
431
|
leavepictureinpicture: () => setInPip(false),
|
|
492
432
|
};
|
|
@@ -497,6 +437,7 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
497
437
|
sync();
|
|
498
438
|
return () => {
|
|
499
439
|
cancelAnimationFrame(frame);
|
|
440
|
+
clearTimeout(stalled);
|
|
500
441
|
for (const [type, handler] of Object.entries(handlers))
|
|
501
442
|
el.removeEventListener(type, handler);
|
|
502
443
|
};
|
|
@@ -732,14 +673,19 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
732
673
|
const el = flashRef.current;
|
|
733
674
|
if (!flash || !el)
|
|
734
675
|
return;
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
676
|
+
// An answer to a press: 2 × --duration (300ms), the motion budget. Under reduced motion it
|
|
677
|
+
// only fades, over as long, on --duration-fade.
|
|
678
|
+
const moves = cssDuration(el) > 0;
|
|
679
|
+
const animation = el.animate(moves
|
|
680
|
+
? [
|
|
739
681
|
{ opacity: 0, transform: "scale(0.85)" },
|
|
740
682
|
{ opacity: 1, transform: "scale(1)", offset: 0.25 },
|
|
741
683
|
{ opacity: 0, transform: "scale(1.15)" },
|
|
742
|
-
]
|
|
684
|
+
]
|
|
685
|
+
: [{ opacity: 0 }, { opacity: 1, offset: 0.2 }, { opacity: 0 }], {
|
|
686
|
+
duration: (moves ? cssDuration(el) : cssTime("--duration-fade", el)) * 2,
|
|
687
|
+
easing: cssEase("--ease", el),
|
|
688
|
+
});
|
|
743
689
|
animation.onfinish = () => setFlash(null);
|
|
744
690
|
return () => animation.cancel();
|
|
745
691
|
}, [flash]);
|
|
@@ -798,17 +744,28 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
798
744
|
const el = jumpRef.current;
|
|
799
745
|
if (!jump || !el)
|
|
800
746
|
return;
|
|
801
|
-
const still = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
802
747
|
// Each press nudges it the way it went; only the first fades in, so a run of them doesn't blink.
|
|
748
|
+
// It answers the press in --duration (a fade alone under reduced motion), is held to be read,
|
|
749
|
+
// and fades out on its own over 2 × --duration-fade, while nobody is waiting on it.
|
|
803
750
|
const from = jump.first ? 0 : 1;
|
|
804
|
-
const
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
751
|
+
const moves = cssDuration(el) > 0;
|
|
752
|
+
const fade = cssTime("--duration-fade", el);
|
|
753
|
+
const arrive = (moves ? cssDuration(el) : fade) / JUMP_MS;
|
|
754
|
+
const leave = 1 - (fade * 2) / JUMP_MS;
|
|
755
|
+
const easing = cssEase("--ease", el);
|
|
756
|
+
const animation = el.animate(moves
|
|
757
|
+
? [
|
|
758
|
+
{ opacity: from, transform: `translateX(${jump.side * -6}px) scale(0.94)`, easing },
|
|
759
|
+
{ opacity: 1, transform: "none", offset: arrive },
|
|
760
|
+
{ opacity: 1, transform: "none", offset: leave, easing },
|
|
810
761
|
{ opacity: 0, transform: "none" },
|
|
811
|
-
]
|
|
762
|
+
]
|
|
763
|
+
: [
|
|
764
|
+
{ opacity: from, easing },
|
|
765
|
+
{ opacity: 1, offset: arrive },
|
|
766
|
+
{ opacity: 1, offset: leave, easing },
|
|
767
|
+
{ opacity: 0 },
|
|
768
|
+
], { duration: JUMP_MS });
|
|
812
769
|
animation.onfinish = () => setJump(null);
|
|
813
770
|
return () => animation.cancel();
|
|
814
771
|
}, [jump]);
|
|
@@ -867,10 +824,31 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
867
824
|
const el = video.current;
|
|
868
825
|
if (!el)
|
|
869
826
|
return;
|
|
870
|
-
|
|
827
|
+
// After a reload that failed too, the place it stopped is still the one to go back to.
|
|
828
|
+
resume.current = { time: el.currentTime || resume.current?.time || startOf, play: true };
|
|
871
829
|
setFailed(false);
|
|
872
830
|
el.load();
|
|
873
831
|
};
|
|
832
|
+
// A stream that dropped while it played (the connection, a server that fell behind) gets one more
|
|
833
|
+
// go by itself, from where it stopped, before the error shows: what "Try again" does. Not at the
|
|
834
|
+
// start, which says the video can't play, and not a stream the app feeds in itself (a blob:).
|
|
835
|
+
autoRetry.current = () => {
|
|
836
|
+
const el = video.current;
|
|
837
|
+
const r = retries.current;
|
|
838
|
+
if (!el || !(el.currentTime || resume.current?.time) || el.currentSrc.startsWith("blob:"))
|
|
839
|
+
return false;
|
|
840
|
+
if (performance.now() - r.at > AUTO_RETRY_MS)
|
|
841
|
+
r.count = 0;
|
|
842
|
+
if (r.count >= RETRY_DELAYS.length)
|
|
843
|
+
return false;
|
|
844
|
+
r.at = performance.now();
|
|
845
|
+
clearTimeout(r.timer);
|
|
846
|
+
// The spinner meanwhile, not the error.
|
|
847
|
+
setWaiting(true);
|
|
848
|
+
r.timer = setTimeout(retry, RETRY_DELAYS[r.count++]);
|
|
849
|
+
return true;
|
|
850
|
+
};
|
|
851
|
+
React.useEffect(() => () => clearTimeout(retries.current.timer), []);
|
|
874
852
|
const nextQuality = qualities[qualities.indexOf(version?.quality ?? "") + 1];
|
|
875
853
|
const togglePip = () => {
|
|
876
854
|
const v = video.current;
|
|
@@ -1027,6 +1005,18 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
1027
1005
|
const controlsHidden = hidden || (!started && !focusIn);
|
|
1028
1006
|
// A big movie frame (a film on a laptop or a TV) gets the prominent controls and a thicker timeline.
|
|
1029
1007
|
const large = movie && frameWidth >= LARGE_FRAME;
|
|
1008
|
+
/*
|
|
1009
|
+
* A narrow movie frame (a phone held upright, about 180px tall) has no room beside the controls
|
|
1010
|
+
* for everything: the skip is small and sits on the end side just above them, the subtitle above
|
|
1011
|
+
* the skip, and the middle button gives its place to both (play and pause stay in the bar); a
|
|
1012
|
+
* line of subtitles hides the title while it shows.
|
|
1013
|
+
*/
|
|
1014
|
+
const narrow = movie && !large && frameWidth > 0 && frameWidth < NARROW_FRAME;
|
|
1015
|
+
const subtitlesOn = subtitle >= 0 && subtitle < tracks.length;
|
|
1016
|
+
// How far a skip on offer reaches in from the frame's end edge, in px (0: none on offer). Wider
|
|
1017
|
+
// frames keep the subtitle on the skip's row, narrowed on both sides to stay clear of it.
|
|
1018
|
+
const [skipReach, setSkipReach] = React.useState(0);
|
|
1019
|
+
const skipShown = skipReach > 0;
|
|
1030
1020
|
const size = movie ? "icon" : "icon-sm";
|
|
1031
1021
|
const textSize = large ? "lg" : movie ? "default" : "sm";
|
|
1032
1022
|
const timeText = large ? "text-sm" : "text-xs";
|
|
@@ -1070,18 +1060,16 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
1070
1060
|
/* ── The controls, placed by the layout below ── */
|
|
1071
1061
|
const playButton = (_jsx(Control, { label: ended ? labels.playAgain : playing ? labels.pause : labels.play, portal: portal, size: size, onClick: togglePlay, children: ended ? _jsx(RotateCcwIcon, {}) : playing ? _jsx(PauseIcon, {}) : _jsx(PlayIcon, {}) }));
|
|
1072
1062
|
const skipButtons = (_jsxs(_Fragment, { children: [_jsx(Control, { label: labels.skipBack(SKIP), portal: portal, size: size, onClick: () => jumpBy(-SKIP), children: _jsx(SkipIcon, { direction: "back", large: large }) }), _jsx(Control, { label: labels.skipForward(SKIP), portal: portal, size: size, onClick: () => jumpBy(SKIP), children: _jsx(SkipIcon, { direction: "forward", large: large }) })] }));
|
|
1073
|
-
const volumeControls = (
|
|
1063
|
+
const volumeControls = (_jsx(MediaVolume, { slot: "video-player", labels: labels, volume: volume, muted: muted, portal: portal, popupClassName: "theme-dark", size: size, large: large, onToggleMute: toggleMute, onVolumeChange: changeVolume,
|
|
1074
1064
|
// In the movie layout's row, free to narrow: its slider gives way before anything overflows.
|
|
1075
|
-
className:
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
movie ? "min-w-10 @min-[38.5rem]/video:block" : "@lg/video:block", large ? "w-24" : movie ? "w-20" : "w-16"), children: _jsx(BaseSlider.Control, { className: "flex w-full cursor-pointer touch-none items-center py-2.5 pr-2.5 pl-1.5", children: _jsxs(BaseSlider.Track, { className: cn(trackClass, large && "h-2"), children: [_jsx(BaseSlider.Indicator, { className: indicatorClass }), _jsx(BaseSlider.Thumb, { "aria-label": labels.volume, className: cn(thumbClass, large && "size-5") })] }) }) })] }));
|
|
1080
|
-
const currentTime = _jsx(Clock, { playhead: playhead, className: timeText });
|
|
1065
|
+
className: movie ? "min-w-0" : "@max-md/video:mr-auto", sliderClassName: cn(
|
|
1066
|
+
// In the movie layout's one row it waits for room, and gives some back when the row runs short (a next control).
|
|
1067
|
+
movie ? "min-w-10 @min-[38.5rem]/video:block" : "@lg/video:block", large ? "w-24" : movie ? "w-20" : "w-16") }));
|
|
1068
|
+
const currentTime = _jsx(MediaClock, { slot: "video-player", playhead: playhead, className: timeText });
|
|
1081
1069
|
// Without a length (a live stream) there is no total, and nothing to count down.
|
|
1082
1070
|
const totalTime = ready ? (_jsx("span", { "data-slot": "video-player-duration", className: cn("shrink-0 font-mono text-muted-foreground tabular-nums", timeText), children: formatTime(duration) })) : null;
|
|
1083
1071
|
const remainingTime = ready ? (_jsx(TimeLeft, { playhead: playhead, duration: duration, labels: labels, className: timeText })) : null;
|
|
1084
|
-
const scrubber = (_jsx(
|
|
1072
|
+
const scrubber = (_jsx(MediaScrubber, { slot: "video-player", playhead: playhead, duration: duration, labels: labels, previews: previews, large: large, frameWidth: frameWidth, className: timeText, onSeek: seekTo, onScrub: scrub, onStep: seekBy }));
|
|
1085
1073
|
// One track toggles in the default layout; several, or the movie layout, get a menu. Its name
|
|
1086
1074
|
// says what it does now, like play's, so it reports no pressed state as well.
|
|
1087
1075
|
const subtitlesControl = tracks.length === 0 ? null : tracks.length === 1 && !movie ? (_jsx(Control, { label: subtitle >= 0 ? labels.hideSubtitles : labels.showSubtitles, portal: portal, size: size, onClick: toggleSubtitles, children: subtitle >= 0 ? _jsx(CaptionsIcon, {}) : _jsx(CaptionsOffIcon, {}) })) : (_jsx(ChoiceMenu, { label: labels.subtitles, portal: portal, onOpenChange: onMenuOpenChange, trigger: _jsx(Button, { variant: "ghost", size: size, "aria-label": `${labels.subtitles}, ${tracks[subtitle]?.label ?? labels.subtitlesOff}`, children: subtitle >= 0 ? _jsx(CaptionsIcon, {}) : _jsx(CaptionsOffIcon, {}) }), value: String(subtitle), onValueChange: (value) => chooseSubtitle(Number(value)), options: [
|
|
@@ -1115,7 +1103,7 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
1115
1103
|
const airPlayControl = canAirPlay ? (_jsx(Control, { label: labels.airPlay, portal: portal, size: size, "aria-pressed": airPlaying, onClick: pickAirPlay, children: _jsx(AirplayIcon, {}) })) : null;
|
|
1116
1104
|
const fullscreenControl = allowFullscreen && canFullscreen ? (_jsx(Control, { label: isFullscreen ? labels.exitFullScreen : labels.fullScreen, portal: portal, size: size, onClick: toggleFullscreen, children: isFullscreen ? _jsx(MinimizeIcon, {}) : _jsx(MaximizeIcon, {}) })) : null;
|
|
1117
1105
|
// Stepped back while playing (and before the first play), unless a control has keyboard focus (`hidden`).
|
|
1118
|
-
const controlsMotion = cn("transition-[opacity,translate] duration-(--duration) ease-
|
|
1106
|
+
const controlsMotion = cn("transition-[opacity,translate] [transition-duration:var(--duration-fade),var(--duration)] ease-(--ease)", "data-hidden:pointer-events-none data-hidden:opacity-0");
|
|
1119
1107
|
const hoverProps = {
|
|
1120
1108
|
onPointerEnter: (event) => event.pointerType !== "touch" && setOverControls(true),
|
|
1121
1109
|
onPointerLeave: () => setOverControls(false),
|
|
@@ -1138,30 +1126,43 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
1138
1126
|
"@container/video relative isolate w-full overflow-hidden bg-black font-body text-foreground select-none", "data-idle:cursor-none", playerVariants[variant], isFullscreen && "rounded-none border-0", className), style: { aspectRatio: isFullscreen ? undefined : aspectRatio, ...style }, ...props, children: [_jsxs("video", { ref: videoRefs, "data-slot": "video-player-video", poster: poster, autoPlay: autoPlay, loop: loop, muted: startMuted, playsInline: true, preload: "metadata", src: typeof current === "string" && current ? startingAt(current, startOf) : undefined, className: "absolute inset-0 size-full bg-black object-contain", children: [typeof current !== "string" &&
|
|
1139
1127
|
current.map((s, i) => (_jsx("source", { src: startingAt(s.src, startOf), type: s.type, onError: i === current.length - 1 ? fail : undefined }, s.src))), tracks
|
|
1140
1128
|
.filter((t) => !t.render)
|
|
1141
|
-
.map((t) => (_jsx("track", { src: loaded[t.src] ?? t.src, label: t.label, srcLang: t.srcLang, kind: t.kind ?? "subtitles" }, loaded[t.src] ?? t.src)))] }), _jsx("div", { "aria-hidden": true, "data-slot": "video-player-stage", className: "absolute inset-0", onPointerUp: handleStageClick, onDoubleClick: () => allowFullscreen && canFullscreen && toggleFullscreen() }), movie && (_jsxs(_Fragment, { children: [_jsx("div", { hidden: failed, "aria-hidden": true, "data-slot": "video-player-scrim", "data-hidden": hidden ? "" : undefined, className: cn("pointer-events-none absolute inset-0 bg-[linear-gradient(to_bottom,rgb(0_0_0/0.55),transparent_22%,transparent_40%,rgb(0_0_0/0.85))]", "transition-opacity duration-(--duration) ease-
|
|
1129
|
+
.map((t) => (_jsx("track", { src: loaded[t.src] ?? t.src, label: t.label, srcLang: t.srcLang, kind: t.kind ?? "subtitles" }, loaded[t.src] ?? t.src)))] }), _jsx("div", { "aria-hidden": true, "data-slot": "video-player-stage", className: "absolute inset-0", onPointerUp: handleStageClick, onDoubleClick: () => allowFullscreen && canFullscreen && toggleFullscreen() }), movie && (_jsxs(_Fragment, { children: [_jsx("div", { hidden: failed, "aria-hidden": true, "data-slot": "video-player-scrim", "data-hidden": hidden ? "" : undefined, className: cn("pointer-events-none absolute inset-0 bg-[linear-gradient(to_bottom,rgb(0_0_0/0.55),transparent_22%,transparent_40%,rgb(0_0_0/0.85))]", "transition-opacity duration-(--duration-fade) ease-(--ease) data-hidden:opacity-0") }), (title || onBack) && (_jsxs("div", { "data-slot": "video-player-title", "data-hidden": hidden ? "" : undefined, ...focusProps, className: cn("theme-dark pointer-events-none absolute inset-x-0 top-0 flex items-center gap-1 bg-transparent px-5 pt-4 @2xl/video:px-7 @2xl/video:pt-6", "transition-opacity duration-(--duration-fade) ease-(--ease) data-hidden:opacity-0 data-hidden:*:pointer-events-none!",
|
|
1142
1130
|
// The arrow stands over the play button, in the controls' own column; the title follows it.
|
|
1143
|
-
onBack && "pt-3 pl-3 @2xl/video:pt-5 @2xl/video:pl-5", large && "[--icon-button:var(--control-h-lg)] [&_button_svg:not([class*='size-'])]:size-5", large && onBack && "pt-5! pl-7!"), children: [onBack && (_jsx(Control, { label: labels.back, portal: portal, size: size, onClick: onBack, className: "pointer-events-auto", children: _jsx(ArrowLeftIcon, { className: "rtl:-scale-x-100" }) })), title && (_jsx("p", { className: "max-w-[min(100%,40rem)] min-w-0 truncate font-heading text-
|
|
1131
|
+
onBack && "pt-3 pl-3 @2xl/video:pt-5 @2xl/video:pl-5", large && "[--icon-button:var(--control-h-lg)] [&_button_svg:not([class*='size-'])]:size-5", large && onBack && "pt-5! pl-7!"), children: [onBack && (_jsx(Control, { label: labels.back, portal: portal, size: size, onClick: onBack, className: "pointer-events-auto", children: _jsx(ArrowLeftIcon, { className: "rtl:-scale-x-100" }) })), title && (_jsx("p", { className: cn("max-w-[min(100%,40rem)] min-w-0 truncate font-heading text-17 font-light text-foreground @2xl/video:text-2xl", "transition-opacity duration-(--duration-fade) ease-(--ease)", narrow && cue && "opacity-0"), children: title }))] }))] })), _jsx("div", { className: "theme-dark pointer-events-none absolute inset-0 flex items-center justify-center bg-transparent text-foreground", children: failed ? (_jsxs("div", { className: "flex flex-col items-center gap-4", children: [_jsxs("p", { "data-slot": "video-player-error", className: "flex items-center gap-2 font-mono text-xs text-muted-foreground", children: [_jsx(VideoOffIcon, { "aria-hidden": true, className: "size-4" }), labels.error] }), _jsxs("div", { className: "pointer-events-auto flex flex-wrap justify-center gap-2", children: [_jsx(Button, { variant: "secondary", size: "sm", onClick: retry, children: labels.retry }), nextQuality && (_jsx(Button, { variant: "ghost", size: "sm", onClick: () => {
|
|
1144
1132
|
switchVersion({ quality: nextQuality });
|
|
1145
1133
|
onQualityChange?.(nextQuality);
|
|
1146
1134
|
}, children: labels.tryQuality(nextQuality) }))] })] })) : preparing ? (_jsx(Spinner, { size: "lg", label: labels.loading })) : !started || ended ? (_jsx(Button, { "data-slot": "video-player-start", variant: "secondary", size: "icon", "aria-label": ended ? labels.playAgain : labels.play, onClick: togglePlay, className: "pointer-events-auto size-(--control-h-lg) [&_svg:not([class*='size-'])]:size-5", children: ended ? _jsx(RotateCcwIcon, {}) : _jsx(PlayIcon, { className: "translate-x-px" }) })) : waiting ? (_jsx(Spinner, { size: "lg", label: labels.loading })) : (_jsx(Button, { "data-slot": "video-player-center", "data-hidden": controlsHidden ? "" : undefined, variant: "secondary", size: "icon", "aria-label": playing ? labels.pause : labels.play, onClick: () => {
|
|
1147
1135
|
togglePlay();
|
|
1148
1136
|
wake();
|
|
1149
|
-
}, className: cn("pointer-events-auto hidden size-(--control-h-lg)
|
|
1137
|
+
}, className: cn("pointer-events-auto hidden size-(--control-h-lg) [&_svg:not([class*='size-'])]:size-5",
|
|
1138
|
+
// A narrow frame's middle goes to the subtitles and the skip.
|
|
1139
|
+
!(narrow && (subtitlesOn || skipShown)) && "pointer-coarse:inline-flex", "transition-opacity duration-(--duration-fade) ease-(--ease) data-hidden:pointer-events-none data-hidden:opacity-0"), children: playing ? _jsx(PauseIcon, {}) : _jsx(PlayIcon, { className: "translate-x-px" }) })) }), jump && (_jsx("div", { "aria-hidden": true, className: cn("theme-dark pointer-events-none absolute inset-y-0 flex w-1/3 items-center justify-center bg-transparent", jump.side < 0 ? "left-0" : "right-0"), children: _jsxs("div", { ref: jumpRef, "data-slot": "video-player-jump", className: cn("flex flex-col items-center justify-center gap-1 rounded-full bg-black/50 text-foreground opacity-0", movie ? "size-20 [&_svg]:size-7" : "size-14 [&_svg]:size-5"), children: [jump.side < 0 ? (_jsx(ChevronsLeftIcon, { strokeWidth: 1.5 })) : (_jsx(ChevronsRightIcon, { strokeWidth: 1.5 })), _jsx("span", { className: cn("font-mono leading-none tabular-nums", movie ? "text-xs" : "text-[10px]"), children: labels.jumped(jump.side * jump.seconds) })] }, jump.n) })), flash && (_jsx("div", { "aria-hidden": true, className: "theme-dark pointer-events-none absolute inset-0 flex items-center justify-center bg-transparent", children: _jsx("div", { ref: flashRef, "data-slot": "video-player-flash", className: cn("flex items-center justify-center rounded-full bg-black/50 text-foreground opacity-0", movie ? "size-20 [&_svg]:size-8" : "size-14 [&_svg]:size-6"), children: flash.playing ? _jsx(PlayIcon, { className: "translate-x-0.5" }) : _jsx(PauseIcon, {}) }, flash.n) })), _jsx("div", { ref: subtitleLayer, "aria-hidden": true, "data-slot": "video-player-subtitle-layer", className: cn("pointer-events-none absolute inset-0 transition-transform duration-(--duration) ease-(--ease)", !controlsHidden &&
|
|
1150
1140
|
(large
|
|
1151
1141
|
? "-translate-y-[calc(var(--control-h-lg)+56px)]"
|
|
1152
1142
|
: movie
|
|
1153
1143
|
? "-translate-y-[calc(var(--control-h)+44px)]"
|
|
1154
|
-
: "-translate-y-[calc(var(--control-h-sm)+28px)]")) }), (cue || subtitleSlow) && (_jsx("div", { "data-slot": "video-player-caption",
|
|
1155
|
-
//
|
|
1144
|
+
: "-translate-y-[calc(var(--control-h-sm)+28px)]")) }), (cue || subtitleSlow) && (_jsx("div", { "data-slot": "video-player-caption",
|
|
1145
|
+
// On the skip's row, narrowed on both sides, so it stays centred and clear of the skip.
|
|
1146
|
+
style: movie && !narrow && skipShown ? { left: skipReach + 8, right: skipReach + 8 } : undefined, className: cn("theme-dark pointer-events-none absolute flex justify-center bg-transparent text-center transition-[bottom] duration-(--duration) ease-(--ease)",
|
|
1147
|
+
// Clear of the back arrow when it reaches the top of a narrow frame.
|
|
1148
|
+
narrow && onBack && !controlsHidden ? "inset-x-14" : "inset-x-4",
|
|
1149
|
+
// Above the controls while they show; low in the frame when they step back. On a narrow
|
|
1150
|
+
// frame, above the skip too, which takes the row over the controls.
|
|
1156
1151
|
controlsHidden
|
|
1157
|
-
?
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1152
|
+
? narrow && skipShown
|
|
1153
|
+
? "bottom-[calc(var(--control-h-sm)+22px)]"
|
|
1154
|
+
: "bottom-4"
|
|
1155
|
+
: narrow
|
|
1156
|
+
? skipShown
|
|
1157
|
+
? "bottom-[calc(var(--control-h)+var(--control-h-sm)+48px)]"
|
|
1158
|
+
: "bottom-[calc(var(--control-h)+42px)]"
|
|
1159
|
+
: large
|
|
1160
|
+
? "bottom-[calc(var(--control-h-lg)+72px)]"
|
|
1161
|
+
: movie
|
|
1162
|
+
? "bottom-[calc(var(--control-h)+60px)]"
|
|
1163
|
+
: "bottom-[calc(var(--control-h-sm)+44px)] @max-md/video:bottom-[calc(var(--control-h-sm)*2+52px)]"), children: _jsx("span", { className: "text-[clamp(15px,2.2cqw,44px)]", children: _jsx("span", { className: cn("inline-block max-w-[min(90cqw,40em)] rounded-item bg-background/80 px-2 py-0.5 leading-snug [overflow-wrap:anywhere] text-foreground", !cue && "text-[0.7em] text-muted-foreground"), style: { fontSize: `${subtitleScale}em` }, children: cue
|
|
1163
1164
|
? cue.split("\n").map((line, i) => (_jsx("span", { dir: "auto", className: "block", children: line }, i)))
|
|
1164
|
-
: labels.preparingSubtitles }) }) })), _jsx(SegmentSkip, { playhead: playhead, segments: segments, live: started && !ended, failed: failed, playing: playing, titleKey: titleKey, sourceKey: srcKey, onSkip: skip, onPress: wake, controlsHidden: controlsHidden, large: large, movie: movie }), !failed &&
|
|
1165
|
+
: labels.preparingSubtitles }) }) })), _jsx(SegmentSkip, { playhead: playhead, segments: segments, live: started && !ended, failed: failed, playing: playing, titleKey: titleKey, sourceKey: srcKey, onSkip: skip, onPress: wake, controlsHidden: controlsHidden, large: large, movie: movie, narrow: narrow, onReachChange: setSkipReach }), !failed &&
|
|
1165
1166
|
(movie ? (_jsxs("div", { "data-slot": "video-player-controls", "data-hidden": controlsHidden ? "" : undefined, ...hoverProps, ...focusProps, className: cn("theme-dark absolute inset-x-0 bottom-0 flex flex-col gap-1 bg-transparent px-3 pb-2 @2xl/video:px-5 @2xl/video:pb-3",
|
|
1166
1167
|
// The prominent size: 46px round controls with larger icons.
|
|
1167
1168
|
large &&
|
|
@@ -1171,81 +1172,24 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
1171
1172
|
* A round ghost button with its name in a tooltip: 30px in the bar, 38px in the movie layout. The
|
|
1172
1173
|
* tooltips are set dark like the controls and their menus, whatever the page's theme.
|
|
1173
1174
|
*/
|
|
1174
|
-
function Control(
|
|
1175
|
-
return
|
|
1175
|
+
function Control(props) {
|
|
1176
|
+
return _jsx(MediaControl, { popupClassName: "theme-dark", ...props });
|
|
1176
1177
|
}
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
const time = usePlayhead(playhead, (s) => formatTime(s.scrub ?? s.time));
|
|
1181
|
-
return (_jsx("span", { "data-slot": "video-player-time", className: cn("shrink-0 font-mono text-foreground tabular-nums", className), children: time }));
|
|
1178
|
+
/** A control that opens a short list of choices, its menu and tooltip dark like the controls. */
|
|
1179
|
+
function ChoiceMenu(props) {
|
|
1180
|
+
return _jsx(MediaChoiceMenu, { popupClassName: "theme-dark", ...props });
|
|
1182
1181
|
}
|
|
1182
|
+
/* ── The parts that follow the playhead: each reads it from the store and redraws on its own ── */
|
|
1183
1183
|
/** What's left, at the timeline's end, the way streaming apps count down: "−18:56". */
|
|
1184
1184
|
function TimeLeft({ playhead, duration, labels, className, }) {
|
|
1185
1185
|
const left = usePlayhead(playhead, (s) => Math.floor(Math.max(0, duration - (s.scrub ?? s.time))));
|
|
1186
1186
|
return (_jsxs("span", { "data-slot": "video-player-remaining", className: cn("min-w-[6ch] shrink-0 text-right font-mono text-muted-foreground tabular-nums", className), children: [_jsx("span", { className: "sr-only", children: labels.remaining(labels.duration(left)) }), _jsxs("span", { "aria-hidden": true, children: ["\u2212", formatTime(left)] })] }));
|
|
1187
1187
|
}
|
|
1188
|
-
/**
|
|
1189
|
-
* The timeline: the part played, the buffered range, and the moment under the pointer with its
|
|
1190
|
-
* still. Left to right on any page, as a timeline runs: like the tape, not like the text.
|
|
1191
|
-
*/
|
|
1192
|
-
function Scrubber({ playhead, duration, labels, previews, large, frameWidth, className, onSeek, onScrub, onStep, }) {
|
|
1193
|
-
const ready = duration > 0;
|
|
1194
|
-
const shown = usePlayhead(playhead, (s) => s.scrub ?? s.time);
|
|
1195
|
-
const scrub = usePlayhead(playhead, (s) => s.scrub);
|
|
1196
|
-
const buffered = usePlayhead(playhead, (s) => s.buffered);
|
|
1197
|
-
const [hover, setHover] = React.useState(null);
|
|
1198
|
-
// The scrubber's width, for keeping a preview inside it.
|
|
1199
|
-
const [trackWidth, setTrackWidth] = React.useState(0);
|
|
1200
|
-
// The moment under the pointer, or under the thumb while dragging (touch has no hover).
|
|
1201
|
-
const peek = hover ?? (scrub !== null && ready ? { ratio: Math.min(1, scrub / duration), time: scrub } : null);
|
|
1202
|
-
const still = peek && previews ? previews(peek.time) : undefined;
|
|
1203
|
-
const stillWidth = Math.min(large ? PREVIEW_WIDTH_LARGE : PREVIEW_WIDTH, frameWidth * 0.4);
|
|
1204
|
-
const stillScale = still ? stillWidth / still.width : 1;
|
|
1205
|
-
// A preview stays within the timeline; a bare time label is narrow enough to centre anywhere.
|
|
1206
|
-
const peekLeft = !peek
|
|
1207
|
-
? 0
|
|
1208
|
-
: still && trackWidth > stillWidth
|
|
1209
|
-
? Math.min(Math.max(peek.ratio * trackWidth, stillWidth / 2), trackWidth - stillWidth / 2)
|
|
1210
|
-
: peek.ratio * trackWidth;
|
|
1211
|
-
return (_jsx(DirectionProvider, { direction: "ltr", children: _jsx(BaseSlider.Root, { "data-slot": "video-player-scrubber",
|
|
1212
|
-
// Without a length (a live stream) the playhead has no place on the track.
|
|
1213
|
-
value: ready ? shown : 0, min: 0, max: ready ? duration : 1, step: SCRUB_STEP, largeStep: 10, disabled: !ready, onValueChange: (value, { reason }) => {
|
|
1214
|
-
// Dragged or pressed, the thumb shows where it's going and holds the controls; a key only seeks.
|
|
1215
|
-
if (reason === "drag" || reason === "track-press")
|
|
1216
|
-
onScrub(value);
|
|
1217
|
-
else
|
|
1218
|
-
onSeek(value);
|
|
1219
|
-
}, onValueCommitted: () => onScrub(null), className: "min-w-0 flex-1", children: _jsxs(BaseSlider.Control, { className: cn("relative flex w-full cursor-pointer touch-none items-center data-disabled:cursor-default", large ? "py-3" : "py-2.5"), onPointerDown: (event) => setTrackWidth(event.currentTarget.getBoundingClientRect().width), onPointerMove: (event) => {
|
|
1220
|
-
if (event.pointerType === "touch" || !ready)
|
|
1221
|
-
return;
|
|
1222
|
-
const r = event.currentTarget.getBoundingClientRect();
|
|
1223
|
-
const ratio = Math.min(1, Math.max(0, (event.clientX - r.left) / r.width));
|
|
1224
|
-
setTrackWidth(r.width);
|
|
1225
|
-
setHover({ ratio, time: ratio * duration });
|
|
1226
|
-
}, onPointerLeave: () => setHover(null), children: [_jsxs(BaseSlider.Track, { className: cn(trackClass, large && "h-2"), children: [_jsx("span", { "aria-hidden": true, "data-slot": "video-player-buffered", className: "absolute inset-y-0 left-0 rounded-full bg-foreground/20 forced-color-adjust-none forced-colors:bg-[GrayText]", style: { width: ready ? `${Math.min(100, (buffered / duration) * 100)}%` : 0 } }), _jsx(BaseSlider.Indicator, { className: indicatorClass }), _jsx(BaseSlider.Thumb, { "aria-label": labels.seek, getAriaValueText: (_, value) => ready
|
|
1227
|
-
? labels.position(labels.duration(value), labels.duration(duration))
|
|
1228
|
-
: labels.duration(shown), className: cn(thumbClass, large && "size-5"), onKeyDown: (event) => {
|
|
1229
|
-
// Arrows step five seconds, the way the player's own shortcuts do.
|
|
1230
|
-
const forward = event.key === "ArrowRight" || event.key === "ArrowUp";
|
|
1231
|
-
const back = event.key === "ArrowLeft" || event.key === "ArrowDown";
|
|
1232
|
-
if (!forward && !back)
|
|
1233
|
-
return;
|
|
1234
|
-
event.preventDefault();
|
|
1235
|
-
onStep(forward ? 5 : -5);
|
|
1236
|
-
} })] }), peek && (_jsxs("span", { "aria-hidden": true, "data-slot": "video-player-hover-time", className: cn("pointer-events-none absolute bottom-full flex -translate-x-1/2 flex-col items-center overflow-hidden rounded-item material-menu font-mono text-foreground tabular-nums", still ? "mb-2" : "mb-1.5", className), style: { left: trackWidth ? peekLeft : `${peek.ratio * 100}%` }, children: [still && (_jsx("span", { "data-slot": "video-player-preview", className: "relative block overflow-hidden bg-black", style: { width: stillWidth, height: (stillWidth * still.height) / still.width }, children: _jsx("img", { src: still.src, alt: "", draggable: false, className: "absolute top-0 left-0 max-w-none origin-top-left", style: {
|
|
1237
|
-
transform: `translate(${-(still.x ?? 0) * stillScale}px, ${-(still.y ?? 0) * stillScale}px) scale(${stillScale})`,
|
|
1238
|
-
// A whole image is drawn at the still's size; a sheet at its own.
|
|
1239
|
-
...(still.x === undefined && still.y === undefined
|
|
1240
|
-
? { width: still.width, height: still.height }
|
|
1241
|
-
: {}),
|
|
1242
|
-
} }) })), _jsx("span", { className: still ? "py-1" : "px-1.5 py-0.5", children: formatTime(peek.time) })] }))] }) }) }));
|
|
1243
|
-
}
|
|
1244
1188
|
/**
|
|
1245
1189
|
* The skip over a stretch while it plays ("Skip intro"), with the fill that runs down while it's
|
|
1246
1190
|
* offered, and the automatic skips.
|
|
1247
1191
|
*/
|
|
1248
|
-
function SegmentSkip({ playhead, segments, live, failed, playing, titleKey, sourceKey, onSkip, onPress, controlsHidden, large, movie, }) {
|
|
1192
|
+
function SegmentSkip({ playhead, segments, live, failed, playing, titleKey, sourceKey, onSkip, onPress, controlsHidden, large, movie, narrow, onReachChange, }) {
|
|
1249
1193
|
// Without segments, the playhead is no concern of this.
|
|
1250
1194
|
const time = usePlayhead(playhead, (s) => (segments.length > 0 ? s.time : 0));
|
|
1251
1195
|
const segment = live ? segments.find((s) => time >= s.start && time < s.end - SEGMENT_TAIL) : undefined;
|
|
@@ -1304,32 +1248,45 @@ function SegmentSkip({ playhead, segments, live, failed, playing, titleKey, sour
|
|
|
1304
1248
|
return;
|
|
1305
1249
|
box.current.closest('[data-slot="video-player"]')?.focus({ preventScroll: true });
|
|
1306
1250
|
}, [shown]);
|
|
1251
|
+
const offered = Boolean(segment && !failed && shown);
|
|
1252
|
+
React.useLayoutEffect(() => {
|
|
1253
|
+
const el = box.current;
|
|
1254
|
+
const frame = el?.closest('[data-slot="video-player"]');
|
|
1255
|
+
if (!offered || !el || !frame) {
|
|
1256
|
+
onReachChange(0);
|
|
1257
|
+
return;
|
|
1258
|
+
}
|
|
1259
|
+
const measure = () => onReachChange(Math.ceil(frame.getBoundingClientRect().right - el.getBoundingClientRect().left));
|
|
1260
|
+
measure();
|
|
1261
|
+
const observer = new ResizeObserver(measure);
|
|
1262
|
+
observer.observe(el);
|
|
1263
|
+
observer.observe(frame);
|
|
1264
|
+
return () => observer.disconnect();
|
|
1265
|
+
}, [offered, onReachChange]);
|
|
1266
|
+
React.useEffect(() => () => onReachChange(0), [onReachChange]);
|
|
1307
1267
|
if (!segment || failed)
|
|
1308
1268
|
return null;
|
|
1309
1269
|
return (_jsx("div", { ref: box, "data-slot": "video-player-segment", "data-hidden": shown ? undefined : "",
|
|
1310
1270
|
// Gone for the pointer, the keyboard and screen readers alike.
|
|
1311
|
-
inert: !shown, className: cn("theme-dark pointer-events-none absolute right-3 flex bg-transparent transition-[bottom,opacity] duration
|
|
1271
|
+
inert: !shown, className: cn("theme-dark pointer-events-none absolute right-3 flex bg-transparent transition-[bottom,opacity] [transition-duration:var(--duration),var(--duration-fade)] ease-(--ease) @2xl/video:right-5", "data-hidden:opacity-0", large && "right-7!", controlsHidden
|
|
1312
1272
|
? large
|
|
1313
1273
|
? "bottom-7"
|
|
1314
1274
|
: "bottom-4"
|
|
1315
1275
|
: large
|
|
1316
1276
|
? "bottom-[calc(var(--control-h-lg)+72px)]"
|
|
1317
|
-
:
|
|
1318
|
-
? "bottom-[calc(var(--control-h)+
|
|
1319
|
-
:
|
|
1277
|
+
: narrow
|
|
1278
|
+
? "bottom-[calc(var(--control-h)+42px)]"
|
|
1279
|
+
: movie
|
|
1280
|
+
? "bottom-[calc(var(--control-h)+60px)]"
|
|
1281
|
+
: "bottom-[calc(var(--control-h-sm)+44px)] @max-md/video:bottom-[calc(var(--control-h-sm)*2+52px)]"), children: _jsxs(Button, { variant: "secondary", size: large ? "lg" : movie && !narrow ? "default" : "sm", onClick: () => {
|
|
1320
1282
|
onSkip(segment);
|
|
1321
1283
|
onPress();
|
|
1322
1284
|
},
|
|
1323
1285
|
// A long label ("Vorspann überspringen …") stays inside the frame, cut short.
|
|
1324
|
-
className: "pointer-events-auto relative max-w-[calc(100cqw-3.5rem)] overflow-hidden transition-opacity duration-(--duration) ease-
|
|
1286
|
+
className: "pointer-events-auto relative max-w-[calc(100cqw-3.5rem)] overflow-hidden transition-opacity duration-(--duration-fade) ease-(--ease) starting:opacity-0", children: [left > 0 && (_jsx("span", { "aria-hidden": true, "data-slot": "video-player-segment-fill",
|
|
1325
1287
|
// Gliding over one time step (0.1 s, two thirds of the motion token) to meet the next.
|
|
1326
1288
|
className: "absolute inset-y-0 left-0 w-full origin-left bg-foreground/20 transition-transform duration-[calc(var(--duration)*2/3)] ease-linear", style: { transform: `scaleX(${left})` } })), _jsx("span", { className: "relative min-w-0 truncate", children: segment.label })] }, segmentKey) }));
|
|
1327
1289
|
}
|
|
1328
|
-
/** A control that opens a short list of choices — subtitles, audio, quality, speed — named by a tooltip. */
|
|
1329
|
-
function ChoiceMenu({ label, portal, trigger, value, onValueChange, options, onOpenChange, }) {
|
|
1330
|
-
const detailed = options.some((option) => option.detail);
|
|
1331
|
-
return (_jsxs(Menu, { onOpenChange: onOpenChange, children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx(MenuTrigger, { render: trigger }) }), _jsx(TooltipContent, { portal: portal, className: "theme-dark", children: label })] }), _jsx(MenuContent, { side: "top", align: "end", portal: portal, className: cn("theme-dark", detailed ? "min-w-56" : "min-w-36"), children: _jsxs(MenuGroup, { children: [_jsx(MenuGroupLabel, { children: label }), _jsx(MenuRadioGroup, { value: value, onValueChange: (next) => onValueChange(String(next)), children: options.map((option) => (_jsxs(MenuRadioItem, { value: option.value, closeOnClick: true, children: [_jsx("span", { className: "flex-1", children: option.label }), option.detail && (_jsx("span", { className: "font-mono text-[12px] text-muted-foreground tabular-nums", children: option.detail }))] }, option.value))) })] }) })] }));
|
|
1332
|
-
}
|
|
1333
1290
|
/**
|
|
1334
1291
|
* The series' episodes, a season at a time, to jump to another, the way streaming apps list them:
|
|
1335
1292
|
* a still with how much was watched, the number and title, the length and a line or two about it.
|
|
@@ -1363,7 +1320,7 @@ function EpisodesMenu({ seasons, current, onSeasonOpen, onSelect, labels, portal
|
|
|
1363
1320
|
// "10 episodes", from the episodes once they're there.
|
|
1364
1321
|
const countOf = (s) => {
|
|
1365
1322
|
const count = s.episodes?.length ?? s.count;
|
|
1366
|
-
return count == null ? null : (_jsx("span", { className: "shrink-0 font-mono text-
|
|
1323
|
+
return count == null ? null : (_jsx("span", { className: "shrink-0 font-mono text-12 text-muted-foreground tabular-nums", children: labels.episodeCount(count) }));
|
|
1367
1324
|
};
|
|
1368
1325
|
const header = season && (_jsxs(_Fragment, { children: [_jsx("span", { className: "min-w-0 flex-1 truncate text-foreground", children: season.label }), countOf(season)] }));
|
|
1369
1326
|
return (_jsxs(Menu, { onOpenChange: (next) => {
|
|
@@ -1378,12 +1335,12 @@ function EpisodesMenu({ seasons, current, onSeasonOpen, onSelect, labels, portal
|
|
|
1378
1335
|
}, children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx(MenuTrigger, { render: _jsx(Button, { variant: "ghost", size: size, "aria-label": labels.episodes, children: _jsx(GalleryVerticalEndIcon, {}) }) }) }), _jsx(TooltipContent, { portal: portal, className: "theme-dark", children: labels.episodes })] }), _jsx(MenuContent, { side: "top", align: "end", portal: portal, className: "theme-dark flex max-h-[min(36rem,var(--available-height,36rem))] w-[min(30rem,var(--available-width))] flex-col overflow-hidden", children: picking ? (_jsxs(MenuGroup, { className: "min-h-0 overflow-y-auto overscroll-contain", children: [_jsx(MenuGroupLabel, { children: labels.seasons }), _jsx(MenuRadioGroup, { value: season?.id ?? "", onValueChange: (id) => showSeason(String(id)), children: seasons.map((s) => (_jsxs(MenuRadioItem, { value: s.id, closeOnClick: false, children: [_jsx("span", { className: "flex-1", children: s.label }), countOf(s)] }, s.id))) })] })) : (_jsxs(_Fragment, { children: [seasons.length > 1 ? (_jsxs(MenuItem, { closeOnClick: false, onClick: () => setPicking(true), "aria-label": `${labels.seasons}: ${season?.label ?? ""}`, className: "shrink-0", children: [_jsx(ChevronLeftIcon, { className: "rtl:-scale-x-100" }), header] })) : (_jsx("div", { className: "flex min-h-(--control-h) shrink-0 items-center gap-2.5 px-2.5 text-sm", children: header })), _jsx(MenuSeparator, { className: "shrink-0" }), _jsx("div", { ref: list, className: "relative min-h-0 overflow-y-auto overscroll-contain", children: _jsx(MenuGroup, { "aria-label": season?.label, "aria-busy": !season?.episodes || undefined, children: season?.episodes
|
|
1379
1336
|
? season.episodes.map((e) => (_jsx(EpisodeItem, { episode: e, playing: e.id === current, labels: labels, onSelect: onSelect }, e.id)))
|
|
1380
1337
|
: // Rows the size of the ones to come, so the list doesn't jump when they do.
|
|
1381
|
-
Array.from({ length: Math.min(season?.count ?? 3, 6) }, (_, i) => (_jsxs("div", { className: "flex items-start gap-3 px-2.5 py-2", children: [_jsx(Skeleton, { shape: "item", className: "aspect-video w-28" }), _jsxs("div", { className: "flex flex-1 flex-col gap-
|
|
1338
|
+
Array.from({ length: Math.min(season?.count ?? 3, 6) }, (_, i) => (_jsxs("div", { className: "flex items-start gap-3 border border-transparent px-2.5 py-2 text-sm", children: [_jsx(Skeleton, { shape: "item", className: "aspect-video w-28" }), _jsxs("div", { className: "flex flex-1 flex-col gap-1 py-0.5", children: [_jsx(Skeleton, { className: "w-2/3" }), _jsx(Skeleton, { lines: 2, className: "text-13 leading-snug" })] })] }, i))) }) })] })) })] }));
|
|
1382
1339
|
}
|
|
1383
1340
|
/** One row of the episode list. The episode playing is marked, and choosing it only closes the list. */
|
|
1384
1341
|
function EpisodeItem({ episode: e, playing, labels, onSelect, }) {
|
|
1385
1342
|
const progress = Math.min(1, Math.max(0, e.progress ?? 0));
|
|
1386
|
-
return (_jsxs(MenuItem, { "data-current": playing ? "" : undefined, "aria-current": playing || undefined, onClick: () => !playing && onSelect(e.id), className: "items-start gap-3 py-2 data-current:bg-foreground/5", children: [_jsxs("span", { className: "relative aspect-video w-28 shrink-0 overflow-hidden rounded-item bg-black ring-1 ring-field-edge", children: [e.image && (_jsx("img", { src: e.image, alt: "", loading: "lazy", decoding: "async", draggable: false, className: "size-full object-cover" })), playing && (_jsx("span", { className: "absolute inset-0 flex items-center justify-center bg-black/45", children: _jsx(PlayIcon, { className: "size-4 translate-x-px text-foreground" }) })), progress > 0 && (_jsx("span", { className: "absolute inset-x-0 bottom-0 h-[3px] bg-foreground/25", children: _jsx("span", { className: "block h-full bg-foreground", style: { width: `${progress * 100}%` } }) }))] }), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-1 py-0.5", children: [_jsxs("span", { className: "flex items-baseline gap-2", children: [e.number != null && (_jsx("span", { className: "shrink-0 font-mono text-
|
|
1343
|
+
return (_jsxs(MenuItem, { "data-current": playing ? "" : undefined, "aria-current": playing || undefined, onClick: () => !playing && onSelect(e.id), className: "items-start gap-3 py-2 data-current:bg-foreground/5", children: [_jsxs("span", { className: "relative aspect-video w-28 shrink-0 overflow-hidden rounded-item bg-black ring-1 ring-field-edge", children: [e.image && (_jsx("img", { src: e.image, alt: "", loading: "lazy", decoding: "async", draggable: false, className: "size-full object-cover" })), playing && (_jsx("span", { className: "absolute inset-0 flex items-center justify-center bg-black/45", children: _jsx(PlayIcon, { className: "size-4 translate-x-px text-foreground" }) })), progress > 0 && (_jsx("span", { className: "absolute inset-x-0 bottom-0 h-[3px] bg-foreground/25", children: _jsx("span", { className: "block h-full bg-foreground", style: { width: `${progress * 100}%` } }) }))] }), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-1 py-0.5", children: [_jsxs("span", { className: "flex items-baseline gap-2", children: [e.number != null && (_jsx("span", { className: "shrink-0 font-mono text-12 text-muted-foreground tabular-nums", children: e.number })), _jsx("span", { className: "min-w-0 flex-1 truncate text-foreground", children: e.title }), (playing || e.duration) && (_jsx("span", { className: "shrink-0 font-mono text-12 text-muted-foreground", children: playing ? labels.nowPlaying : e.duration }))] }), e.description && (_jsx("span", { className: "line-clamp-2 text-13 leading-snug text-muted-foreground", children: e.description }))] })] }));
|
|
1387
1344
|
}
|
|
1388
1345
|
/** A turning arrow with the seconds it skips, set in Licht Mono inside it. */
|
|
1389
1346
|
function SkipIcon({ direction, large }) {
|