@ohmykreee/dsh-remote-control 0.0.0-stage → 1.0.2
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/AGENTS.md +556 -0
- package/INSTALLATION.md +310 -0
- package/LICENSE +21 -0
- package/README.md +195 -2
- package/client.js +3 -0
- package/components.json +20 -0
- package/cordis.patch.yml +3 -0
- package/docs/README.en.md +196 -0
- package/docs/screenshots/en/overview.png +0 -0
- package/docs/screenshots/en/question.png +0 -0
- package/docs/screenshots/zh/overview.png +0 -0
- package/docs/screenshots/zh/question.png +0 -0
- package/icon.svg +24 -0
- package/index.js +2 -0
- package/lib/account.js +1 -0
- package/lib/app-mapping.js +1 -0
- package/lib/i18n.js +1 -0
- package/lib/media-enrich.js +1 -0
- package/lib/notifications.js +1 -0
- package/lib/performance.js +1 -0
- package/lib/platform/index.js +1 -0
- package/lib/probe-adapter.js +1 -0
- package/lib/probe-daemon.js +1 -0
- package/lib/probe.js +1 -0
- package/lib/qr.js +1 -0
- package/lib/runtime.js +1 -0
- package/lib/service.js +1 -0
- package/lib/sessions.js +1 -0
- package/lib/settings.js +1 -0
- package/lib/types.js +1 -0
- package/lib/util.js +1 -0
- package/lib/weather.js +1 -0
- package/lib/ws.js +1 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +118 -4
- package/scripts/browser-shot.mjs +217 -0
- package/scripts/build-dsh.mjs +228 -0
- package/scripts/build-rust.mjs +319 -0
- package/scripts/build-web.mjs +17 -0
- package/scripts/check-npm-package.mjs +322 -0
- package/scripts/mock-preview.py +574 -0
- package/scripts/screenshot-compose.py +89 -0
- package/scripts/screenshot-device.sh +75 -0
- package/src/dsh/client/api.ts +68 -0
- package/src/dsh/client/i18n.ts +573 -0
- package/src/dsh/client/icons.ts +56 -0
- package/src/dsh/client/index.ts +95 -0
- package/src/dsh/client/logic.ts +310 -0
- package/src/dsh/client/panel.ts +483 -0
- package/src/dsh/client/sections/apps.ts +40 -0
- package/src/dsh/client/sections/balance.ts +38 -0
- package/src/dsh/client/sections/connection.ts +97 -0
- package/src/dsh/client/sections/notifications.ts +43 -0
- package/src/dsh/client/sections/pomodoro.ts +184 -0
- package/src/dsh/client/sections/preferences.ts +138 -0
- package/src/dsh/client/sections/system.ts +120 -0
- package/src/dsh/client/sections/weather.ts +276 -0
- package/src/dsh/client/styles.ts +1119 -0
- package/src/dsh/client/types.ts +366 -0
- package/src/dsh/client/ui.ts +142 -0
- package/src/dsh/index.ts +108 -0
- package/src/dsh/lib/account.ts +520 -0
- package/src/dsh/lib/app-mapping.ts +366 -0
- package/src/dsh/lib/i18n.ts +82 -0
- package/src/dsh/lib/media-enrich.ts +202 -0
- package/src/dsh/lib/notifications.ts +322 -0
- package/src/dsh/lib/performance.ts +279 -0
- package/src/dsh/lib/platform/index.ts +43 -0
- package/src/dsh/lib/probe-adapter.ts +275 -0
- package/src/dsh/lib/probe-daemon.ts +359 -0
- package/src/dsh/lib/probe.ts +395 -0
- package/src/dsh/lib/qr.ts +42 -0
- package/src/dsh/lib/runtime.ts +126 -0
- package/src/dsh/lib/service.ts +1645 -0
- package/src/dsh/lib/sessions.ts +907 -0
- package/src/dsh/lib/settings.ts +468 -0
- package/src/dsh/lib/types.ts +231 -0
- package/src/dsh/lib/util.ts +115 -0
- package/src/dsh/lib/weather.ts +532 -0
- package/src/dsh/lib/ws.ts +328 -0
- package/src/dsh/types/qrcode-generator.d.ts +16 -0
- package/src/rust/Cargo.lock +1431 -0
- package/src/rust/Cargo.toml +68 -0
- package/src/rust/src/cli.rs +233 -0
- package/src/rust/src/daemon.rs +140 -0
- package/src/rust/src/location/linux.rs +118 -0
- package/src/rust/src/location/macos.rs +26 -0
- package/src/rust/src/location/mod.rs +170 -0
- package/src/rust/src/location/windows.rs +205 -0
- package/src/rust/src/main.rs +42 -0
- package/src/rust/src/media/catalog.rs +454 -0
- package/src/rust/src/media/linux.rs +350 -0
- package/src/rust/src/media/macos/accessibility.rs +59 -0
- package/src/rust/src/media/macos.rs +366 -0
- package/src/rust/src/media/mod.rs +298 -0
- package/src/rust/src/media/vendor/apple_music.rs +90 -0
- package/src/rust/src/media/vendor/common.rs +186 -0
- package/src/rust/src/media/vendor/kugou.rs +52 -0
- package/src/rust/src/media/vendor/kuwo.rs +49 -0
- package/src/rust/src/media/vendor/mod.rs +75 -0
- package/src/rust/src/media/vendor/netease.rs +1715 -0
- package/src/rust/src/media/vendor/qishui.rs +36 -0
- package/src/rust/src/media/vendor/qqmusic.rs +33 -0
- package/src/rust/src/media/vendor/spotify.rs +46 -0
- package/src/rust/src/media/vendor/wesing.rs +39 -0
- package/src/rust/src/media/vendor/youtube_music.rs +49 -0
- package/src/rust/src/media/windows/accessibility.rs +85 -0
- package/src/rust/src/media/windows/audio.rs +116 -0
- package/src/rust/src/media/windows/private.rs +291 -0
- package/src/rust/src/media/windows.rs +775 -0
- package/src/rust/src/notifications/linux.rs +276 -0
- package/src/rust/src/notifications/macos.rs +382 -0
- package/src/rust/src/notifications/mod.rs +244 -0
- package/src/rust/src/notifications/windows.rs +565 -0
- package/src/rust/src/perf/common.rs +109 -0
- package/src/rust/src/perf/linux.rs +282 -0
- package/src/rust/src/perf/macos.rs +28 -0
- package/src/rust/src/perf/mod.rs +157 -0
- package/src/rust/src/perf/windows.rs +981 -0
- package/src/rust/src/util.rs +360 -0
- package/src/rust/src/volume/linux.rs +195 -0
- package/src/rust/src/volume/macos.rs +54 -0
- package/src/rust/src/volume/mod.rs +116 -0
- package/src/rust/src/volume/windows.rs +75 -0
- package/src/rust/tests/cli.rs +79 -0
- package/src/rust/tests/daemon.rs +107 -0
- package/src/svelte/App.svelte +385 -0
- package/src/svelte/index.html +18 -0
- package/src/svelte/lib/billing.svelte.ts +228 -0
- package/src/svelte/lib/components/BalanceCard.svelte +173 -0
- package/src/svelte/lib/components/ClockCard.svelte +183 -0
- package/src/svelte/lib/components/CountdownCard.svelte +261 -0
- package/src/svelte/lib/components/CpuMemoryCard.svelte +238 -0
- package/src/svelte/lib/components/EmptyState.svelte +34 -0
- package/src/svelte/lib/components/GpuCard.svelte +245 -0
- package/src/svelte/lib/components/HomePage.svelte +34 -0
- package/src/svelte/lib/components/MusicControls.svelte +256 -0
- package/src/svelte/lib/components/MusicCover.svelte +88 -0
- package/src/svelte/lib/components/MusicPage.svelte +116 -0
- package/src/svelte/lib/components/NotificationsCard.svelte +109 -0
- package/src/svelte/lib/components/Panel.svelte +22 -0
- package/src/svelte/lib/components/PerformancePage.svelte +55 -0
- package/src/svelte/lib/components/PomodoroCard.svelte +250 -0
- package/src/svelte/lib/components/QuestionSheet.svelte +354 -0
- package/src/svelte/lib/components/RadialGauge.svelte +99 -0
- package/src/svelte/lib/components/Rail.svelte +217 -0
- package/src/svelte/lib/components/SectionHeader.svelte +40 -0
- package/src/svelte/lib/components/SeekBar.svelte +421 -0
- package/src/svelte/lib/components/SessionList.svelte +364 -0
- package/src/svelte/lib/components/SessionStats.svelte +98 -0
- package/src/svelte/lib/components/SessionsPage.svelte +61 -0
- package/src/svelte/lib/components/SpendCard.svelte +105 -0
- package/src/svelte/lib/components/ThermalCard.svelte +249 -0
- package/src/svelte/lib/components/Toast.svelte +32 -0
- package/src/svelte/lib/components/WeatherIcon.svelte +40 -0
- package/src/svelte/lib/components/WeatherPanel.svelte +420 -0
- package/src/svelte/lib/components/ui/alert/alert-action.svelte +20 -0
- package/src/svelte/lib/components/ui/alert/alert-description.svelte +23 -0
- package/src/svelte/lib/components/ui/alert/alert-title.svelte +23 -0
- package/src/svelte/lib/components/ui/alert/alert.svelte +43 -0
- package/src/svelte/lib/components/ui/alert/index.ts +17 -0
- package/src/svelte/lib/components/ui/avatar/avatar-badge.svelte +26 -0
- package/src/svelte/lib/components/ui/avatar/avatar-fallback.svelte +20 -0
- package/src/svelte/lib/components/ui/avatar/avatar-group-count.svelte +23 -0
- package/src/svelte/lib/components/ui/avatar/avatar-group.svelte +23 -0
- package/src/svelte/lib/components/ui/avatar/avatar-image.svelte +17 -0
- package/src/svelte/lib/components/ui/avatar/avatar.svelte +26 -0
- package/src/svelte/lib/components/ui/avatar/index.ts +22 -0
- package/src/svelte/lib/components/ui/badge/badge.svelte +49 -0
- package/src/svelte/lib/components/ui/badge/index.ts +2 -0
- package/src/svelte/lib/components/ui/button/button.svelte +82 -0
- package/src/svelte/lib/components/ui/button/index.ts +17 -0
- package/src/svelte/lib/components/ui/card/card-action.svelte +23 -0
- package/src/svelte/lib/components/ui/card/card-content.svelte +20 -0
- package/src/svelte/lib/components/ui/card/card-description.svelte +20 -0
- package/src/svelte/lib/components/ui/card/card-footer.svelte +20 -0
- package/src/svelte/lib/components/ui/card/card-header.svelte +23 -0
- package/src/svelte/lib/components/ui/card/card-title.svelte +20 -0
- package/src/svelte/lib/components/ui/card/card.svelte +22 -0
- package/src/svelte/lib/components/ui/card/index.ts +25 -0
- package/src/svelte/lib/components/ui/dialog/dialog-close.svelte +11 -0
- package/src/svelte/lib/components/ui/dialog/dialog-content.svelte +48 -0
- package/src/svelte/lib/components/ui/dialog/dialog-description.svelte +17 -0
- package/src/svelte/lib/components/ui/dialog/dialog-footer.svelte +32 -0
- package/src/svelte/lib/components/ui/dialog/dialog-header.svelte +20 -0
- package/src/svelte/lib/components/ui/dialog/dialog-overlay.svelte +17 -0
- package/src/svelte/lib/components/ui/dialog/dialog-portal.svelte +7 -0
- package/src/svelte/lib/components/ui/dialog/dialog-title.svelte +17 -0
- package/src/svelte/lib/components/ui/dialog/dialog-trigger.svelte +11 -0
- package/src/svelte/lib/components/ui/dialog/dialog.svelte +7 -0
- package/src/svelte/lib/components/ui/dialog/index.ts +34 -0
- package/src/svelte/lib/components/ui/empty/empty-content.svelte +23 -0
- package/src/svelte/lib/components/ui/empty/empty-description.svelte +23 -0
- package/src/svelte/lib/components/ui/empty/empty-header.svelte +20 -0
- package/src/svelte/lib/components/ui/empty/empty-media.svelte +41 -0
- package/src/svelte/lib/components/ui/empty/empty-title.svelte +20 -0
- package/src/svelte/lib/components/ui/empty/empty.svelte +23 -0
- package/src/svelte/lib/components/ui/empty/index.ts +22 -0
- package/src/svelte/lib/components/ui/input/index.ts +7 -0
- package/src/svelte/lib/components/ui/input/input.svelte +48 -0
- package/src/svelte/lib/components/ui/progress/index.ts +7 -0
- package/src/svelte/lib/components/ui/progress/progress.svelte +27 -0
- package/src/svelte/lib/components/ui/scroll-area/index.ts +10 -0
- package/src/svelte/lib/components/ui/scroll-area/scroll-area-scrollbar.svelte +30 -0
- package/src/svelte/lib/components/ui/scroll-area/scroll-area.svelte +43 -0
- package/src/svelte/lib/components/ui/separator/index.ts +7 -0
- package/src/svelte/lib/components/ui/separator/separator.svelte +21 -0
- package/src/svelte/lib/components/ui/sheet/index.ts +34 -0
- package/src/svelte/lib/components/ui/sheet/sheet-close.svelte +7 -0
- package/src/svelte/lib/components/ui/sheet/sheet-content.svelte +55 -0
- package/src/svelte/lib/components/ui/sheet/sheet-description.svelte +17 -0
- package/src/svelte/lib/components/ui/sheet/sheet-footer.svelte +20 -0
- package/src/svelte/lib/components/ui/sheet/sheet-header.svelte +20 -0
- package/src/svelte/lib/components/ui/sheet/sheet-overlay.svelte +20 -0
- package/src/svelte/lib/components/ui/sheet/sheet-portal.svelte +7 -0
- package/src/svelte/lib/components/ui/sheet/sheet-title.svelte +17 -0
- package/src/svelte/lib/components/ui/sheet/sheet-trigger.svelte +7 -0
- package/src/svelte/lib/components/ui/sheet/sheet.svelte +7 -0
- package/src/svelte/lib/components/ui/skeleton/index.ts +7 -0
- package/src/svelte/lib/components/ui/skeleton/skeleton.svelte +17 -0
- package/src/svelte/lib/components/ui/slider/index.ts +7 -0
- package/src/svelte/lib/components/ui/slider/slider.svelte +52 -0
- package/src/svelte/lib/components/ui/tooltip/index.ts +19 -0
- package/src/svelte/lib/components/ui/tooltip/tooltip-content.svelte +51 -0
- package/src/svelte/lib/components/ui/tooltip/tooltip-portal.svelte +7 -0
- package/src/svelte/lib/components/ui/tooltip/tooltip-provider.svelte +7 -0
- package/src/svelte/lib/components/ui/tooltip/tooltip-trigger.svelte +7 -0
- package/src/svelte/lib/components/ui/tooltip/tooltip.svelte +7 -0
- package/src/svelte/lib/countdown.svelte.ts +252 -0
- package/src/svelte/lib/format.ts +199 -0
- package/src/svelte/lib/i18n.svelte.ts +583 -0
- package/src/svelte/lib/media.ts +32 -0
- package/src/svelte/lib/pages.ts +18 -0
- package/src/svelte/lib/pomodoro.svelte.ts +223 -0
- package/src/svelte/lib/session-tree.ts +80 -0
- package/src/svelte/lib/state.svelte.ts +359 -0
- package/src/svelte/lib/timer-alarm.svelte.ts +319 -0
- package/src/svelte/lib/types.ts +306 -0
- package/src/svelte/lib/utils.ts +8 -0
- package/src/svelte/lib/weather.ts +84 -0
- package/src/svelte/lib/ws.ts +104 -0
- package/src/svelte/main.ts +13 -0
- package/src/svelte/styles/global.css +315 -0
- package/src/svelte/vite-env.d.ts +12 -0
- package/static/fonts/LICENSE.txt +287 -0
- package/static/icon.svg +24 -0
- package/static/manifest.webmanifest +18 -0
- package/svelte.config.js +5 -0
- package/tsconfig.dsh-client.json +18 -0
- package/tsconfig.dsh.json +21 -0
- package/tsconfig.json +20 -0
- package/vite.config.js +31 -0
- package/web/assets/index-DLdSfnJ3.css +1 -0
- package/web/assets/index-YNE8X0Uy.js +6 -0
- package/web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/web/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
- package/web/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/web/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/web/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/web/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/web/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/web/assets/noto-sans-sc-100-wght-normal-DluiXYzi.woff2 +0 -0
- package/web/assets/noto-sans-sc-101-wght-normal-CPkZHnw0.woff2 +0 -0
- package/web/assets/noto-sans-sc-102-wght-normal-gzIulUH6.woff2 +0 -0
- package/web/assets/noto-sans-sc-103-wght-normal-CJfSBxFo.woff2 +0 -0
- package/web/assets/noto-sans-sc-104-wght-normal-B3QMglgE.woff2 +0 -0
- package/web/assets/noto-sans-sc-105-wght-normal-xXh_OMfk.woff2 +0 -0
- package/web/assets/noto-sans-sc-106-wght-normal-B9n3jMjP.woff2 +0 -0
- package/web/assets/noto-sans-sc-107-wght-normal-D7fvVprN.woff2 +0 -0
- package/web/assets/noto-sans-sc-108-wght-normal-J0_LhxVo.woff2 +0 -0
- package/web/assets/noto-sans-sc-109-wght-normal-Dsp-De_0.woff2 +0 -0
- package/web/assets/noto-sans-sc-110-wght-normal-DE_6NUrb.woff2 +0 -0
- package/web/assets/noto-sans-sc-111-wght-normal-C4S-TlTn.woff2 +0 -0
- package/web/assets/noto-sans-sc-112-wght-normal-BcFuP3w6.woff2 +0 -0
- package/web/assets/noto-sans-sc-113-wght-normal-Dk932kmj.woff2 +0 -0
- package/web/assets/noto-sans-sc-114-wght-normal-CO_5Xo-i.woff2 +0 -0
- package/web/assets/noto-sans-sc-115-wght-normal-BWy07H14.woff2 +0 -0
- package/web/assets/noto-sans-sc-116-wght-normal-B4HVAfHo.woff2 +0 -0
- package/web/assets/noto-sans-sc-117-wght-normal-siZzFqgK.woff2 +0 -0
- package/web/assets/noto-sans-sc-118-wght-normal-xhBB7f6V.woff2 +0 -0
- package/web/assets/noto-sans-sc-119-wght-normal-Ck_g2FGz.woff2 +0 -0
- package/web/assets/noto-sans-sc-21-wght-normal-D0x9-yBt.woff2 +0 -0
- package/web/assets/noto-sans-sc-22-wght-normal-BBUVTShg.woff2 +0 -0
- package/web/assets/noto-sans-sc-23-wght-normal-Du1oYWkE.woff2 +0 -0
- package/web/assets/noto-sans-sc-24-wght-normal-CmWjJ0gt.woff2 +0 -0
- package/web/assets/noto-sans-sc-25-wght-normal-BFHiqilg.woff2 +0 -0
- package/web/assets/noto-sans-sc-26-wght-normal-C0sF2Z2f.woff2 +0 -0
- package/web/assets/noto-sans-sc-27-wght-normal-COFdrquJ.woff2 +0 -0
- package/web/assets/noto-sans-sc-28-wght-normal-DMgdNu1o.woff2 +0 -0
- package/web/assets/noto-sans-sc-29-wght-normal-Cmq8em30.woff2 +0 -0
- package/web/assets/noto-sans-sc-30-wght-normal-CZWqZ3yU.woff2 +0 -0
- package/web/assets/noto-sans-sc-31-wght-normal-Wfi_lutW.woff2 +0 -0
- package/web/assets/noto-sans-sc-32-wght-normal-BRJQ4PY5.woff2 +0 -0
- package/web/assets/noto-sans-sc-33-wght-normal-CUVQXNAJ.woff2 +0 -0
- package/web/assets/noto-sans-sc-34-wght-normal-Bspba0wC.woff2 +0 -0
- package/web/assets/noto-sans-sc-35-wght-normal-K8fX_YPG.woff2 +0 -0
- package/web/assets/noto-sans-sc-36-wght-normal-CkITyjoT.woff2 +0 -0
- package/web/assets/noto-sans-sc-37-wght-normal-WCZ2zfEe.woff2 +0 -0
- package/web/assets/noto-sans-sc-38-wght-normal-DeM7CUce.woff2 +0 -0
- package/web/assets/noto-sans-sc-39-wght-normal-BMZNLWQU.woff2 +0 -0
- package/web/assets/noto-sans-sc-4-wght-normal-AR5bdDjz.woff2 +0 -0
- package/web/assets/noto-sans-sc-40-wght-normal-BQ5xpS5j.woff2 +0 -0
- package/web/assets/noto-sans-sc-41-wght-normal-Hthm7FFi.woff2 +0 -0
- package/web/assets/noto-sans-sc-42-wght-normal-eaS2gKds.woff2 +0 -0
- package/web/assets/noto-sans-sc-43-wght-normal-o-T53XXV.woff2 +0 -0
- package/web/assets/noto-sans-sc-44-wght-normal-BJH5J4Ez.woff2 +0 -0
- package/web/assets/noto-sans-sc-45-wght-normal-BKuxSCOJ.woff2 +0 -0
- package/web/assets/noto-sans-sc-46-wght-normal-BR_5Mu6e.woff2 +0 -0
- package/web/assets/noto-sans-sc-47-wght-normal-CyY7gKNX.woff2 +0 -0
- package/web/assets/noto-sans-sc-48-wght-normal-BNMfTR6k.woff2 +0 -0
- package/web/assets/noto-sans-sc-49-wght-normal-DX-0y7wg.woff2 +0 -0
- package/web/assets/noto-sans-sc-5-wght-normal-CfWugllB.woff2 +0 -0
- package/web/assets/noto-sans-sc-50-wght-normal-DAOGW-Dr.woff2 +0 -0
- package/web/assets/noto-sans-sc-51-wght-normal-BlFLOjcP.woff2 +0 -0
- package/web/assets/noto-sans-sc-52-wght-normal-OZjrybnw.woff2 +0 -0
- package/web/assets/noto-sans-sc-53-wght-normal-CwyWNT6x.woff2 +0 -0
- package/web/assets/noto-sans-sc-54-wght-normal-DM0nRe18.woff2 +0 -0
- package/web/assets/noto-sans-sc-55-wght-normal-DBK2wUOR.woff2 +0 -0
- package/web/assets/noto-sans-sc-56-wght-normal-C-VKK1LS.woff2 +0 -0
- package/web/assets/noto-sans-sc-57-wght-normal-Cdbfh5kq.woff2 +0 -0
- package/web/assets/noto-sans-sc-58-wght-normal-CflMKARZ.woff2 +0 -0
- package/web/assets/noto-sans-sc-59-wght-normal-BS4Kwzxx.woff2 +0 -0
- package/web/assets/noto-sans-sc-6-wght-normal-ChnZIQfQ.woff2 +0 -0
- package/web/assets/noto-sans-sc-60-wght-normal-B7QOYsXJ.woff2 +0 -0
- package/web/assets/noto-sans-sc-61-wght-normal-C8JjQS7w.woff2 +0 -0
- package/web/assets/noto-sans-sc-62-wght-normal-bS4wq1Gg.woff2 +0 -0
- package/web/assets/noto-sans-sc-63-wght-normal-BJr8P-OB.woff2 +0 -0
- package/web/assets/noto-sans-sc-64-wght-normal-DVB11t7j.woff2 +0 -0
- package/web/assets/noto-sans-sc-65-wght-normal-DMPCXBvK.woff2 +0 -0
- package/web/assets/noto-sans-sc-66-wght-normal-BobaG10V.woff2 +0 -0
- package/web/assets/noto-sans-sc-67-wght-normal-Dzk7WhCR.woff2 +0 -0
- package/web/assets/noto-sans-sc-68-wght-normal-DGbCD9xu.woff2 +0 -0
- package/web/assets/noto-sans-sc-69-wght-normal-Ctrv1EqA.woff2 +0 -0
- package/web/assets/noto-sans-sc-70-wght-normal-RgTO941D.woff2 +0 -0
- package/web/assets/noto-sans-sc-71-wght-normal-D9sG-CWv.woff2 +0 -0
- package/web/assets/noto-sans-sc-72-wght-normal-C4oWy3ul.woff2 +0 -0
- package/web/assets/noto-sans-sc-73-wght-normal-B1ZoOTgM.woff2 +0 -0
- package/web/assets/noto-sans-sc-74-wght-normal-F7dH_rZJ.woff2 +0 -0
- package/web/assets/noto-sans-sc-75-wght-normal-Cp2wp4si.woff2 +0 -0
- package/web/assets/noto-sans-sc-76-wght-normal-B494D7xS.woff2 +0 -0
- package/web/assets/noto-sans-sc-77-wght-normal-B3MVY9Ax.woff2 +0 -0
- package/web/assets/noto-sans-sc-78-wght-normal-5jX7iNMC.woff2 +0 -0
- package/web/assets/noto-sans-sc-79-wght-normal-BIoZy8fr.woff2 +0 -0
- package/web/assets/noto-sans-sc-80-wght-normal-Bje1Fxy1.woff2 +0 -0
- package/web/assets/noto-sans-sc-81-wght-normal-B2NN7Qi3.woff2 +0 -0
- package/web/assets/noto-sans-sc-82-wght-normal-CUggNZi4.woff2 +0 -0
- package/web/assets/noto-sans-sc-83-wght-normal-99rD8YO-.woff2 +0 -0
- package/web/assets/noto-sans-sc-84-wght-normal-zMBmUocm.woff2 +0 -0
- package/web/assets/noto-sans-sc-85-wght-normal-CjI3qdxG.woff2 +0 -0
- package/web/assets/noto-sans-sc-86-wght-normal-BHY8TVEH.woff2 +0 -0
- package/web/assets/noto-sans-sc-87-wght-normal-DioZSHnU.woff2 +0 -0
- package/web/assets/noto-sans-sc-88-wght-normal-BXYxwf2t.woff2 +0 -0
- package/web/assets/noto-sans-sc-89-wght-normal-ClMFrFaL.woff2 +0 -0
- package/web/assets/noto-sans-sc-90-wght-normal-BnOlPreP.woff2 +0 -0
- package/web/assets/noto-sans-sc-91-wght-normal-DTr9RQcS.woff2 +0 -0
- package/web/assets/noto-sans-sc-97-wght-normal-9u6Aiav-.woff2 +0 -0
- package/web/assets/noto-sans-sc-98-wght-normal-BR-H2C0V.woff2 +0 -0
- package/web/assets/noto-sans-sc-99-wght-normal-BI6XPoxp.woff2 +0 -0
- package/web/assets/noto-sans-sc-cyrillic-wght-normal-BGmsQlw-.woff2 +0 -0
- package/web/assets/noto-sans-sc-latin-ext-wght-normal-DuJTpTg_.woff2 +0 -0
- package/web/assets/noto-sans-sc-latin-wght-normal-DDW8mKAR.woff2 +0 -0
- package/web/assets/noto-sans-sc-vietnamese-wght-normal-Bi3ATJ76.woff2 +0 -0
- package/web/fonts/LICENSE.txt +287 -0
- package/web/icon.svg +24 -0
- package/web/index.html +19 -0
- package/web/manifest.webmanifest +18 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Component } from 'svelte';
|
|
3
|
+
import { app } from '../state.svelte';
|
|
4
|
+
import type { PageKey } from '../types';
|
|
5
|
+
import { pageLabel, t } from '../i18n.svelte';
|
|
6
|
+
import { Button } from '$lib/components/ui/button/index.js';
|
|
7
|
+
import { cn } from '$lib/utils.js';
|
|
8
|
+
import House from '@lucide/svelte/icons/house';
|
|
9
|
+
import Layers3 from '@lucide/svelte/icons/layers-3';
|
|
10
|
+
import Music2 from '@lucide/svelte/icons/music-2';
|
|
11
|
+
import Cpu from '@lucide/svelte/icons/cpu';
|
|
12
|
+
import Maximize2 from '@lucide/svelte/icons/maximize-2';
|
|
13
|
+
import Minimize2 from '@lucide/svelte/icons/minimize-2';
|
|
14
|
+
import RefreshCw from '@lucide/svelte/icons/refresh-cw';
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
order,
|
|
18
|
+
activeKey,
|
|
19
|
+
questionCount = 0,
|
|
20
|
+
errorCount = 0,
|
|
21
|
+
timerAlert = false,
|
|
22
|
+
onNavigate,
|
|
23
|
+
onFullscreen,
|
|
24
|
+
onRefresh,
|
|
25
|
+
}: {
|
|
26
|
+
order: PageKey[];
|
|
27
|
+
activeKey: PageKey;
|
|
28
|
+
questionCount?: number;
|
|
29
|
+
errorCount?: number;
|
|
30
|
+
/** Pomodoro or countdown is ringing; mirrors the page-tab indicator. */
|
|
31
|
+
timerAlert?: boolean;
|
|
32
|
+
onNavigate: (key: PageKey) => void;
|
|
33
|
+
onFullscreen: () => void;
|
|
34
|
+
onRefresh: () => void;
|
|
35
|
+
} = $props();
|
|
36
|
+
|
|
37
|
+
const icons: Record<PageKey, Component<{ class?: string; strokeWidth?: number }>> = {
|
|
38
|
+
home: House,
|
|
39
|
+
sessions: Layers3,
|
|
40
|
+
music: Music2,
|
|
41
|
+
performance: Cpu,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const fullscreenTitle = $derived(app.fullscreen ? t('fullscreenExit') : t('fullscreenEnter'));
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<aside class="rail" aria-label={t('navLabel')}>
|
|
48
|
+
<nav class="rail-nav" aria-label={t('pagesLabel')}>
|
|
49
|
+
{#each order as key (key)}
|
|
50
|
+
{@const Icon = icons[key]}
|
|
51
|
+
<Button
|
|
52
|
+
variant="ghost"
|
|
53
|
+
size="icon"
|
|
54
|
+
class={cn(
|
|
55
|
+
'rail-button relative size-[44px] rounded-[13px] text-muted-foreground',
|
|
56
|
+
activeKey === key && 'is-active bg-primary text-primary-foreground',
|
|
57
|
+
)}
|
|
58
|
+
type="button"
|
|
59
|
+
data-key={key}
|
|
60
|
+
aria-label={pageLabel(key)}
|
|
61
|
+
aria-current={activeKey === key ? 'page' : undefined}
|
|
62
|
+
title={pageLabel(key)}
|
|
63
|
+
onclick={() => onNavigate(key)}
|
|
64
|
+
>
|
|
65
|
+
<Icon class="size-[21px]" strokeWidth={1.7} />
|
|
66
|
+
{#if key === 'sessions' && questionCount + errorCount > 0}
|
|
67
|
+
<span
|
|
68
|
+
class="rail-badge"
|
|
69
|
+
class:is-error={errorCount > 0}
|
|
70
|
+
aria-label={errorCount > 0 ? t('errorSessions') : t('pendingQuestions')}
|
|
71
|
+
></span>
|
|
72
|
+
{/if}
|
|
73
|
+
{#if key === 'home' && timerAlert}
|
|
74
|
+
<span class="rail-badge is-timer" aria-label={t('timerAlert')}></span>
|
|
75
|
+
{/if}
|
|
76
|
+
</Button>
|
|
77
|
+
{/each}
|
|
78
|
+
</nav>
|
|
79
|
+
|
|
80
|
+
<div class="rail-bottom">
|
|
81
|
+
<Button
|
|
82
|
+
variant="ghost"
|
|
83
|
+
size="icon"
|
|
84
|
+
class="rail-utility size-10 rounded-[12px] text-muted-foreground"
|
|
85
|
+
type="button"
|
|
86
|
+
aria-label={t('refreshPage')}
|
|
87
|
+
title={t('refreshPage')}
|
|
88
|
+
onclick={onRefresh}
|
|
89
|
+
>
|
|
90
|
+
<RefreshCw class="size-[20px]" strokeWidth={1.7} />
|
|
91
|
+
</Button>
|
|
92
|
+
<Button
|
|
93
|
+
variant="ghost"
|
|
94
|
+
size="icon"
|
|
95
|
+
class="rail-utility size-10 rounded-[12px] text-muted-foreground"
|
|
96
|
+
type="button"
|
|
97
|
+
aria-label={fullscreenTitle}
|
|
98
|
+
title={fullscreenTitle}
|
|
99
|
+
onclick={onFullscreen}
|
|
100
|
+
>
|
|
101
|
+
{#if app.fullscreen}
|
|
102
|
+
<Minimize2 class="size-[20px]" strokeWidth={1.7} />
|
|
103
|
+
{:else}
|
|
104
|
+
<Maximize2 class="size-[20px]" strokeWidth={1.7} />
|
|
105
|
+
{/if}
|
|
106
|
+
</Button>
|
|
107
|
+
</div>
|
|
108
|
+
</aside>
|
|
109
|
+
|
|
110
|
+
<style>
|
|
111
|
+
.rail {
|
|
112
|
+
flex: 0 0 56px;
|
|
113
|
+
width: 56px;
|
|
114
|
+
min-height: 0;
|
|
115
|
+
display: flex;
|
|
116
|
+
flex-direction: column;
|
|
117
|
+
align-items: center;
|
|
118
|
+
justify-content: space-between;
|
|
119
|
+
gap: 16px;
|
|
120
|
+
padding: 9px 6px;
|
|
121
|
+
border: 1px solid var(--border);
|
|
122
|
+
border-radius: 20px;
|
|
123
|
+
background: color-mix(in srgb, var(--card) 94%, transparent);
|
|
124
|
+
box-shadow: 0 18px 44px rgb(0 0 0 / 12%);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.rail-nav {
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-direction: column;
|
|
130
|
+
align-items: center;
|
|
131
|
+
gap: 6px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
:global(.rail-button) {
|
|
135
|
+
flex: 0 0 auto;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
:global(.rail-button svg) {
|
|
139
|
+
width: 21px;
|
|
140
|
+
height: 21px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
:global(.rail-button.is-active) {
|
|
144
|
+
border: 1px solid color-mix(in srgb, var(--brand) 26%, transparent);
|
|
145
|
+
box-shadow: 0 7px 18px rgb(29 55 148 / 20%);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* The rail is a static tab strip: no hover feedback on desktop pointers. */
|
|
149
|
+
:global(.rail-button:hover),
|
|
150
|
+
:global(.rail-utility:hover) {
|
|
151
|
+
background: transparent !important;
|
|
152
|
+
color: var(--muted-foreground) !important;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
:global(.rail-button.is-active:hover) {
|
|
156
|
+
background: var(--primary) !important;
|
|
157
|
+
color: var(--primary-foreground) !important;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.rail-badge {
|
|
161
|
+
position: absolute;
|
|
162
|
+
top: 7px;
|
|
163
|
+
right: 7px;
|
|
164
|
+
width: 7px;
|
|
165
|
+
height: 7px;
|
|
166
|
+
border-radius: 50%;
|
|
167
|
+
background: var(--warn);
|
|
168
|
+
box-shadow: 0 0 0 2px var(--card);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.rail-badge.is-error {
|
|
172
|
+
background: var(--danger);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.rail-badge.is-timer {
|
|
176
|
+
background: var(--success);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.rail-bottom {
|
|
180
|
+
display: flex;
|
|
181
|
+
flex-direction: column;
|
|
182
|
+
align-items: center;
|
|
183
|
+
justify-content: center;
|
|
184
|
+
gap: 6px;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
:global(.app-shell.nav-top) .rail,
|
|
188
|
+
:global(.app-shell.nav-bottom) .rail {
|
|
189
|
+
flex: 0 0 auto;
|
|
190
|
+
width: 100%;
|
|
191
|
+
min-height: auto;
|
|
192
|
+
flex-direction: row;
|
|
193
|
+
padding: 7px 10px;
|
|
194
|
+
border-radius: 18px;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
:global(.app-shell.nav-top) .rail-nav,
|
|
198
|
+
:global(.app-shell.nav-bottom) .rail-nav {
|
|
199
|
+
flex-direction: row;
|
|
200
|
+
gap: 4px;
|
|
201
|
+
overflow-x: auto;
|
|
202
|
+
scrollbar-width: none;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
:global(.app-shell.nav-top) .rail-bottom,
|
|
206
|
+
:global(.app-shell.nav-bottom) .rail-bottom {
|
|
207
|
+
flex-direction: row;
|
|
208
|
+
gap: 8px;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
:global(.app-shell.nav-top .rail-button),
|
|
212
|
+
:global(.app-shell.nav-bottom .rail-button) {
|
|
213
|
+
width: 42px;
|
|
214
|
+
height: 42px;
|
|
215
|
+
border-radius: 12px;
|
|
216
|
+
}
|
|
217
|
+
</style>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Component, Snippet } from 'svelte';
|
|
3
|
+
import { cn } from '$lib/utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
icon: Icon,
|
|
7
|
+
eyebrow,
|
|
8
|
+
title,
|
|
9
|
+
description,
|
|
10
|
+
class: className = '',
|
|
11
|
+
children: actions,
|
|
12
|
+
}: {
|
|
13
|
+
icon?: Component<{ class?: string; strokeWidth?: number }>;
|
|
14
|
+
eyebrow?: string;
|
|
15
|
+
title: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
class?: string;
|
|
18
|
+
children?: Snippet;
|
|
19
|
+
} = $props();
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<div class={cn('flex items-start justify-between gap-4', className)}>
|
|
23
|
+
<div class="flex min-w-0 items-center gap-3">
|
|
24
|
+
{#if Icon}
|
|
25
|
+
<span class="grid size-11 shrink-0 place-items-center rounded-[13px] border border-border bg-secondary text-brand">
|
|
26
|
+
<Icon class="size-[23px]" strokeWidth={1.8} />
|
|
27
|
+
</span>
|
|
28
|
+
{/if}
|
|
29
|
+
<div class="min-w-0">
|
|
30
|
+
{#if eyebrow}<p class="eyebrow">{eyebrow}</p>{/if}
|
|
31
|
+
<h2 class="mt-1 truncate text-[24px] leading-tight font-semibold tracking-[-0.025em] text-foreground">
|
|
32
|
+
{title}
|
|
33
|
+
</h2>
|
|
34
|
+
{#if description}<p class="mt-1 truncate text-[15px] text-muted-foreground">{description}</p>{/if}
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
{#if actions}
|
|
38
|
+
<div class="shrink-0">{@render actions()}</div>
|
|
39
|
+
{/if}
|
|
40
|
+
</div>
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from 'svelte';
|
|
3
|
+
import { sineInOut } from 'svelte/easing';
|
|
4
|
+
import { Tween } from 'svelte/motion';
|
|
5
|
+
import { formatDuration } from '../format';
|
|
6
|
+
import { t } from '../i18n.svelte';
|
|
7
|
+
import { isPlaying, isSeekable, mediaDuration, seekMaximum } from '../media';
|
|
8
|
+
import type { MediaInfo } from '../types';
|
|
9
|
+
import { cn } from '$lib/utils.js';
|
|
10
|
+
|
|
11
|
+
let {
|
|
12
|
+
media,
|
|
13
|
+
onSeek,
|
|
14
|
+
class: className = '',
|
|
15
|
+
}: {
|
|
16
|
+
media: MediaInfo | null;
|
|
17
|
+
onSeek: (value: number) => void;
|
|
18
|
+
class?: string;
|
|
19
|
+
} = $props();
|
|
20
|
+
|
|
21
|
+
const duration = $derived(mediaDuration(media));
|
|
22
|
+
const max = $derived(seekMaximum(media));
|
|
23
|
+
const playing = $derived(isPlaying(media));
|
|
24
|
+
const hasTotal = $derived(Boolean(media) && duration > 0);
|
|
25
|
+
const hasCurrent = $derived(
|
|
26
|
+
Boolean(media) && media?.position !== null && media?.position !== undefined && Number.isFinite(Number(media.position)),
|
|
27
|
+
);
|
|
28
|
+
const hasTimeline = $derived(hasTotal && hasCurrent);
|
|
29
|
+
const seekable = $derived(Boolean(media && isSeekable(media) && hasTimeline));
|
|
30
|
+
|
|
31
|
+
// One long sine path in SVG user units (1 unit = 1 px, no viewBox), shifted
|
|
32
|
+
// by the live phase so the pattern is pinned to the leading edge. The phase
|
|
33
|
+
// shift (0..40) and drift (0..40) add up, so the path starts several periods
|
|
34
|
+
// left of the viewport — the visible left edge is always in the middle of
|
|
35
|
+
// the path, never on its start cap.
|
|
36
|
+
const WAVE_PERIOD = 40;
|
|
37
|
+
const WAVE_MIDDLE = 12;
|
|
38
|
+
const WAVE_AMPLITUDE = 2.52;
|
|
39
|
+
const WAVE_CONTROL_Y = WAVE_MIDDLE - WAVE_AMPLITUDE * 2;
|
|
40
|
+
const WAVE_LEAD = WAVE_PERIOD * 5;
|
|
41
|
+
const WAVE_PATH = buildWavePath();
|
|
42
|
+
|
|
43
|
+
function buildWavePath(): string {
|
|
44
|
+
let d = `M${-WAVE_LEAD} ${WAVE_MIDDLE}`;
|
|
45
|
+
for (let x = -WAVE_LEAD; x < 4000; x += WAVE_PERIOD) {
|
|
46
|
+
d += ` Q${x + 10} ${WAVE_CONTROL_Y} ${x + 20} ${WAVE_MIDDLE} T${x + WAVE_PERIOD} ${WAVE_MIDDLE}`;
|
|
47
|
+
}
|
|
48
|
+
return d;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let now = $state(Date.now());
|
|
52
|
+
let dragging = $state(false);
|
|
53
|
+
let dragValue = $state(0);
|
|
54
|
+
let trackEl = $state<HTMLDivElement | null>(null);
|
|
55
|
+
let trackWidth = $state(0);
|
|
56
|
+
let anchor = 0;
|
|
57
|
+
let anchorAt = Date.now();
|
|
58
|
+
let lastKey = '';
|
|
59
|
+
let pendingValue = 0;
|
|
60
|
+
let pendingUntil = 0;
|
|
61
|
+
let lastSentValue = -1;
|
|
62
|
+
let lastSentAt = 0;
|
|
63
|
+
let activePointerId: number | null = null;
|
|
64
|
+
|
|
65
|
+
// Only a live, advancing timeline gets the wave. Pausing, dragging and
|
|
66
|
+
// unavailable timelines (fixed at 100%) fall back to a straight bar.
|
|
67
|
+
const flowing = $derived(hasTimeline && playing && !dragging);
|
|
68
|
+
|
|
69
|
+
const reduceMotion = typeof window !== 'undefined'
|
|
70
|
+
&& window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
71
|
+
|
|
72
|
+
// Freeze the phase (the CSS drift pauses immediately), hold for 120 ms,
|
|
73
|
+
// then tween the wave's amplitude into the line — and the exact reverse
|
|
74
|
+
// when playback resumes. Both directions share these options. The resting
|
|
75
|
+
// value is 0.001, not 0: a singular scaleY culls the path, while 0.001
|
|
76
|
+
// still renders its non-scaling 4px stroke as the straight bar.
|
|
77
|
+
const waveAmplitude = Tween.of(
|
|
78
|
+
() => (flowing ? 1 : 0.001),
|
|
79
|
+
{
|
|
80
|
+
duration: reduceMotion ? 0 : 320,
|
|
81
|
+
delay: reduceMotion ? 0 : 120,
|
|
82
|
+
easing: sineInOut,
|
|
83
|
+
},
|
|
84
|
+
);
|
|
85
|
+
const waveScale = $derived(waveAmplitude.current);
|
|
86
|
+
|
|
87
|
+
function clampPosition(value: number): number {
|
|
88
|
+
const limit = duration > 0 ? duration : max;
|
|
89
|
+
return Math.max(0, Math.min(limit, value));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function positionAt(timestamp: number, isPlayingNow = playing): number {
|
|
93
|
+
let value = anchor;
|
|
94
|
+
if (isPlayingNow && timestamp > anchorAt) value += (timestamp - anchorAt) / 1000;
|
|
95
|
+
return clampPosition(value);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const position = $derived.by(() => {
|
|
99
|
+
if (!media) return 0;
|
|
100
|
+
if (dragging) return clampPosition(dragValue);
|
|
101
|
+
return positionAt(now);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const percent = $derived(max > 0 ? Math.min(100, Math.max(0, (position / max) * 100)) : 0);
|
|
105
|
+
const displayPercent = $derived(!media ? 0 : !hasTotal ? 100 : hasTimeline ? percent : 0);
|
|
106
|
+
const wavePercent = $derived(seekable ? percent : displayPercent);
|
|
107
|
+
const waveWidth = $derived((trackWidth * wavePercent) / 100);
|
|
108
|
+
const phaseLock = $derived(((waveWidth % WAVE_PERIOD) + WAVE_PERIOD) % WAVE_PERIOD);
|
|
109
|
+
const currentLabel = $derived(hasTimeline ? formatDuration(position) : '--:--');
|
|
110
|
+
const totalLabel = $derived(hasTotal ? formatDuration(duration) : '--:--');
|
|
111
|
+
|
|
112
|
+
function trackKey(item: MediaInfo | null): string {
|
|
113
|
+
if (!item) return '';
|
|
114
|
+
return `${item.appId || ''}\u0000${item.title || ''}\u0000${item.endTime || 0}`;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Keep the local timeline moving even when the Host keeps resending the
|
|
118
|
+
// same cached media snapshot. Only meaningful jumps/track/play-state changes
|
|
119
|
+
// re-anchor the bar.
|
|
120
|
+
$effect(() => {
|
|
121
|
+
const currentMedia = media;
|
|
122
|
+
const timestamp = Date.now();
|
|
123
|
+
if (!currentMedia) {
|
|
124
|
+
anchor = 0;
|
|
125
|
+
anchorAt = timestamp;
|
|
126
|
+
lastKey = '';
|
|
127
|
+
pendingUntil = 0;
|
|
128
|
+
now = timestamp;
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const key = trackKey(currentMedia);
|
|
133
|
+
const reported = Number(currentMedia.position) || 0;
|
|
134
|
+
const isPlayingNow = isPlaying(currentMedia);
|
|
135
|
+
|
|
136
|
+
if (key !== lastKey || dragging) {
|
|
137
|
+
if (key !== lastKey) {
|
|
138
|
+
lastKey = key;
|
|
139
|
+
anchor = clampPosition(reported);
|
|
140
|
+
anchorAt = timestamp;
|
|
141
|
+
pendingUntil = 0;
|
|
142
|
+
}
|
|
143
|
+
now = timestamp;
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (pendingUntil > timestamp) {
|
|
148
|
+
if (Math.abs(reported - pendingValue) <= 4) {
|
|
149
|
+
pendingUntil = 0;
|
|
150
|
+
anchor = clampPosition(reported);
|
|
151
|
+
anchorAt = timestamp;
|
|
152
|
+
}
|
|
153
|
+
now = timestamp;
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (!isPlayingNow) {
|
|
158
|
+
anchor = clampPosition(reported);
|
|
159
|
+
anchorAt = timestamp;
|
|
160
|
+
} else {
|
|
161
|
+
const current = positionAt(timestamp, true);
|
|
162
|
+
if (reported > current + 2.5) {
|
|
163
|
+
anchor = clampPosition(reported);
|
|
164
|
+
anchorAt = timestamp;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
now = timestamp;
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
onMount(() => {
|
|
171
|
+
const timer = setInterval(() => {
|
|
172
|
+
now = Date.now();
|
|
173
|
+
}, 100);
|
|
174
|
+
return () => clearInterval(timer);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
function valueFromPointer(clientX: number): number {
|
|
178
|
+
if (!trackEl) return position;
|
|
179
|
+
const rect = trackEl.getBoundingClientRect();
|
|
180
|
+
if (rect.width <= 0) return 0;
|
|
181
|
+
const ratio = Math.min(1, Math.max(0, (clientX - rect.left) / rect.width));
|
|
182
|
+
return ratio * max;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function commit(value: number): void {
|
|
186
|
+
if (!media) return;
|
|
187
|
+
const timestamp = Date.now();
|
|
188
|
+
const target = clampPosition(value);
|
|
189
|
+
dragging = false;
|
|
190
|
+
dragValue = target;
|
|
191
|
+
anchor = target;
|
|
192
|
+
anchorAt = timestamp;
|
|
193
|
+
pendingValue = target;
|
|
194
|
+
pendingUntil = timestamp + 8000;
|
|
195
|
+
|
|
196
|
+
// A pointer gesture and a keyboard adjustment must submit exactly one
|
|
197
|
+
// seek; duplicate actions make the player jump twice.
|
|
198
|
+
if (timestamp - lastSentAt < 400 && Math.abs(target - lastSentValue) < 0.5) return;
|
|
199
|
+
lastSentAt = timestamp;
|
|
200
|
+
lastSentValue = target;
|
|
201
|
+
onSeek(target);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function handlePointerDown(event: PointerEvent): void {
|
|
205
|
+
if (!seekable || dragging) return;
|
|
206
|
+
if (event.pointerType === 'mouse' && event.button !== 0) return;
|
|
207
|
+
event.preventDefault();
|
|
208
|
+
event.stopPropagation();
|
|
209
|
+
activePointerId = event.pointerId;
|
|
210
|
+
dragging = true;
|
|
211
|
+
dragValue = valueFromPointer(event.clientX);
|
|
212
|
+
try {
|
|
213
|
+
trackEl?.setPointerCapture(event.pointerId);
|
|
214
|
+
} catch {
|
|
215
|
+
// Pointer capture is best-effort; window pointerup still finishes the drag.
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function handlePointerMove(event: PointerEvent): void {
|
|
220
|
+
if (!dragging || event.pointerId !== activePointerId) return;
|
|
221
|
+
event.preventDefault();
|
|
222
|
+
dragValue = valueFromPointer(event.clientX);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function handlePointerUp(event: PointerEvent): void {
|
|
226
|
+
if (!dragging || event.pointerId !== activePointerId) return;
|
|
227
|
+
const target = valueFromPointer(event.clientX);
|
|
228
|
+
try {
|
|
229
|
+
trackEl?.releasePointerCapture(event.pointerId);
|
|
230
|
+
} catch {
|
|
231
|
+
// The pointer may already have been released by the browser.
|
|
232
|
+
}
|
|
233
|
+
activePointerId = null;
|
|
234
|
+
commit(target);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function cancelPointer(): void {
|
|
238
|
+
if (!seekable) return;
|
|
239
|
+
dragging = false;
|
|
240
|
+
activePointerId = null;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function handleKeydown(event: KeyboardEvent): void {
|
|
244
|
+
if (!seekable) return;
|
|
245
|
+
const smallStep = event.shiftKey ? 30 : 5;
|
|
246
|
+
let target: number | null = null;
|
|
247
|
+
if (event.key === 'ArrowLeft' || event.key === 'ArrowDown') target = position - smallStep;
|
|
248
|
+
else if (event.key === 'ArrowRight' || event.key === 'ArrowUp') target = position + smallStep;
|
|
249
|
+
else if (event.key === 'PageDown') target = position - 30;
|
|
250
|
+
else if (event.key === 'PageUp') target = position + 30;
|
|
251
|
+
else if (event.key === 'Home') target = 0;
|
|
252
|
+
else if (event.key === 'End') target = duration;
|
|
253
|
+
if (target === null) return;
|
|
254
|
+
event.preventDefault();
|
|
255
|
+
event.stopPropagation();
|
|
256
|
+
commit(target);
|
|
257
|
+
}
|
|
258
|
+
</script>
|
|
259
|
+
|
|
260
|
+
<svelte:window onpointerup={handlePointerUp} onpointercancel={cancelPointer} />
|
|
261
|
+
|
|
262
|
+
{#snippet waveLine()}
|
|
263
|
+
<svg class="seek-wave" style={`width: ${wavePercent}%`} height="24" aria-hidden="true">
|
|
264
|
+
<g transform={`translate(${phaseLock} 0)`}>
|
|
265
|
+
<g class="seek-wave-drift">
|
|
266
|
+
<g class="seek-wave-amplitude" style={`transform: scaleY(${waveScale})`}>
|
|
267
|
+
<path class="seek-wave-line" d={WAVE_PATH} vector-effect="non-scaling-stroke" />
|
|
268
|
+
</g>
|
|
269
|
+
</g>
|
|
270
|
+
</g>
|
|
271
|
+
</svg>
|
|
272
|
+
{/snippet}
|
|
273
|
+
|
|
274
|
+
<div class={cn('seek-bar', className)} bind:clientWidth={trackWidth}>
|
|
275
|
+
{#if seekable}
|
|
276
|
+
<div
|
|
277
|
+
bind:this={trackEl}
|
|
278
|
+
class="seek-hit"
|
|
279
|
+
role="slider"
|
|
280
|
+
tabindex="0"
|
|
281
|
+
aria-label={t('playProgress')}
|
|
282
|
+
aria-valuemin={0}
|
|
283
|
+
aria-valuemax={Math.round(max)}
|
|
284
|
+
aria-valuenow={Math.round(position)}
|
|
285
|
+
aria-valuetext="{currentLabel} / {totalLabel}"
|
|
286
|
+
onpointerdown={handlePointerDown}
|
|
287
|
+
onpointermove={handlePointerMove}
|
|
288
|
+
onkeydown={handleKeydown}
|
|
289
|
+
>
|
|
290
|
+
<div class="seek-track" class:is-flowing={flowing}>
|
|
291
|
+
<div class="seek-rest" style={`left: ${percent}%`}></div>
|
|
292
|
+
{@render waveLine()}
|
|
293
|
+
<div class="seek-thumb" style={`left: ${percent}%`}></div>
|
|
294
|
+
</div>
|
|
295
|
+
</div>
|
|
296
|
+
{:else}
|
|
297
|
+
<div
|
|
298
|
+
class="seek-readonly"
|
|
299
|
+
title={!hasTotal ? t('progressUnavailable') : hasTimeline ? t('progressReadOnly') : t('playProgress')}
|
|
300
|
+
>
|
|
301
|
+
<div
|
|
302
|
+
class="seek-track"
|
|
303
|
+
class:is-flowing={flowing}
|
|
304
|
+
role="progressbar"
|
|
305
|
+
aria-label={hasTotal ? t('playProgress') : t('progressUnavailable')}
|
|
306
|
+
aria-valuemin={0}
|
|
307
|
+
aria-valuemax={100}
|
|
308
|
+
aria-valuenow={Math.round(displayPercent)}
|
|
309
|
+
aria-valuetext={hasTimeline ? `${currentLabel} / ${totalLabel}` : undefined}
|
|
310
|
+
>
|
|
311
|
+
<div class="seek-rest" style={`left: ${displayPercent}%`}></div>
|
|
312
|
+
{@render waveLine()}
|
|
313
|
+
</div>
|
|
314
|
+
</div>
|
|
315
|
+
{/if}
|
|
316
|
+
|
|
317
|
+
<div class={cn('mt-2 flex items-center justify-between text-[16px] text-muted-foreground', seekable && 'mt-0')}>
|
|
318
|
+
<span class="numeric">{currentLabel}</span>
|
|
319
|
+
<span class="numeric">{totalLabel}</span>
|
|
320
|
+
</div>
|
|
321
|
+
</div>
|
|
322
|
+
|
|
323
|
+
<style>
|
|
324
|
+
.seek-hit {
|
|
325
|
+
display: flex;
|
|
326
|
+
height: 44px;
|
|
327
|
+
align-items: center;
|
|
328
|
+
cursor: pointer;
|
|
329
|
+
touch-action: none;
|
|
330
|
+
outline: none;
|
|
331
|
+
user-select: none;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.seek-hit:focus-visible {
|
|
335
|
+
outline: none;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.seek-hit:focus-visible .seek-track {
|
|
339
|
+
box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 32%, transparent);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.seek-readonly {
|
|
343
|
+
display: flex;
|
|
344
|
+
height: 24px;
|
|
345
|
+
align-items: center;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.seek-track {
|
|
349
|
+
position: relative;
|
|
350
|
+
width: 100%;
|
|
351
|
+
height: 4px;
|
|
352
|
+
border-radius: 999px;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.seek-rest {
|
|
356
|
+
position: absolute;
|
|
357
|
+
top: 0;
|
|
358
|
+
right: 0;
|
|
359
|
+
bottom: 0;
|
|
360
|
+
border-radius: 999px;
|
|
361
|
+
background: color-mix(in srgb, var(--foreground) 14%, transparent);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/* A single long sine path is shifted by `phaseLock` so its phase is pinned
|
|
365
|
+
to the leading edge, then scrolled by the drift animation. Only the
|
|
366
|
+
amplitude group scales, and vector-effect keeps the 4px stroke intact:
|
|
367
|
+
the crests flatten into the same 4px line instead of fading into it. */
|
|
368
|
+
.seek-wave {
|
|
369
|
+
position: absolute;
|
|
370
|
+
top: 50%;
|
|
371
|
+
left: 0;
|
|
372
|
+
display: block;
|
|
373
|
+
height: 24px;
|
|
374
|
+
overflow: hidden;
|
|
375
|
+
color: var(--brand);
|
|
376
|
+
transform: translateY(-50%);
|
|
377
|
+
pointer-events: none;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.seek-wave-line {
|
|
381
|
+
fill: none;
|
|
382
|
+
stroke: currentColor;
|
|
383
|
+
stroke-width: 4;
|
|
384
|
+
stroke-linecap: round;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.seek-wave-amplitude {
|
|
388
|
+
transform-box: view-box;
|
|
389
|
+
transform-origin: 0 12px;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.seek-wave-drift {
|
|
393
|
+
animation: seek-wave-drift 3.8s linear infinite;
|
|
394
|
+
animation-play-state: paused;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.is-flowing .seek-wave-drift {
|
|
398
|
+
animation-play-state: running;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.seek-thumb {
|
|
402
|
+
position: absolute;
|
|
403
|
+
top: 50%;
|
|
404
|
+
width: 5px;
|
|
405
|
+
height: 24px;
|
|
406
|
+
border-radius: 999px;
|
|
407
|
+
background: var(--brand);
|
|
408
|
+
transform: translate(-50%, -50%);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
@keyframes seek-wave-drift {
|
|
412
|
+
from {
|
|
413
|
+
transform: translateX(0);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
to {
|
|
417
|
+
transform: translateX(40px);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
</style>
|