@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,276 @@
|
|
|
1
|
+
/** Weather section: location permission, city search, source, and forecast mode. */
|
|
2
|
+
|
|
3
|
+
import type * as React from 'react';
|
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { Btn, Field, Seg, groupHead, h, sectionHead } from '../ui.js';
|
|
6
|
+
import type { GeocodePlace, PanelApi, Translator } from '../types.js';
|
|
7
|
+
import { accessLabel } from '../logic.js';
|
|
8
|
+
import { GEOCODE_URL, describeError, isRecord, requestJson } from '../api.js';
|
|
9
|
+
|
|
10
|
+
type SearchStatus = 'idle' | 'loading' | 'ready' | 'error';
|
|
11
|
+
|
|
12
|
+
interface CitySearchProps {
|
|
13
|
+
t: Translator;
|
|
14
|
+
value: string;
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
onChange: (value: string) => void;
|
|
17
|
+
onSelect: (place: GeocodePlace) => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function readPlaces(payload: unknown): GeocodePlace[] {
|
|
21
|
+
const record = isRecord(payload) ? payload : {};
|
|
22
|
+
const raw: unknown[] = Array.isArray(record.results) ? record.results : [];
|
|
23
|
+
const places: GeocodePlace[] = [];
|
|
24
|
+
for (const item of raw) {
|
|
25
|
+
if (!isRecord(item)) continue;
|
|
26
|
+
const name = typeof item.name === 'string' ? item.name.trim() : '';
|
|
27
|
+
const latitude = Number(item.latitude);
|
|
28
|
+
const longitude = Number(item.longitude);
|
|
29
|
+
if (!name || !Number.isFinite(latitude) || !Number.isFinite(longitude)) continue;
|
|
30
|
+
places.push({
|
|
31
|
+
id: Number.isFinite(Number(item.id)) ? Number(item.id) : undefined,
|
|
32
|
+
name,
|
|
33
|
+
latitude,
|
|
34
|
+
longitude,
|
|
35
|
+
country: typeof item.country === 'string' ? item.country : '',
|
|
36
|
+
admin1: typeof item.admin1 === 'string' ? item.admin1 : '',
|
|
37
|
+
timezone: typeof item.timezone === 'string' ? item.timezone : '',
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return places;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function placeMeta(place: GeocodePlace): string {
|
|
44
|
+
return [place.admin1, place.country]
|
|
45
|
+
.map((part) => (part || '').trim())
|
|
46
|
+
.filter(Boolean)
|
|
47
|
+
.join(' · ');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* City combobox for the manual weather location. Typing queries the Host's
|
|
52
|
+
* Open-Meteo geocoding proxy after a short debounce; picking a result hands the
|
|
53
|
+
* coordinates to the section, which writes them into the coordinate fields.
|
|
54
|
+
*/
|
|
55
|
+
function CitySearch({ t, value, disabled, onChange, onSelect }: CitySearchProps): React.ReactElement {
|
|
56
|
+
const [open, setOpen] = useState(false);
|
|
57
|
+
const [status, setStatus] = useState<SearchStatus>('idle');
|
|
58
|
+
const [places, setPlaces] = useState<GeocodePlace[]>([]);
|
|
59
|
+
const [active, setActive] = useState(-1);
|
|
60
|
+
const [failure, setFailure] = useState('');
|
|
61
|
+
const wrapRef = useRef<HTMLDivElement | null>(null);
|
|
62
|
+
const inputRef = useRef<HTMLInputElement | null>(null);
|
|
63
|
+
|
|
64
|
+
// Automatic mode disables the field; an open list must not linger.
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (disabled) setOpen(false);
|
|
67
|
+
}, [disabled]);
|
|
68
|
+
|
|
69
|
+
// Dismiss the list when clicking anywhere else on the page.
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (!open) return;
|
|
72
|
+
const onPointerDown = (event: PointerEvent): void => {
|
|
73
|
+
const target = event.target;
|
|
74
|
+
if (wrapRef.current && target instanceof Node && wrapRef.current.contains(target)) return;
|
|
75
|
+
setOpen(false);
|
|
76
|
+
};
|
|
77
|
+
document.addEventListener('pointerdown', onPointerDown);
|
|
78
|
+
return () => document.removeEventListener('pointerdown', onPointerDown);
|
|
79
|
+
}, [open]);
|
|
80
|
+
|
|
81
|
+
// Debounced search through the Host proxy. Keystrokes abort the previous
|
|
82
|
+
// request so an older result cannot overwrite a newer query.
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if (!open || disabled) {
|
|
85
|
+
setStatus('idle');
|
|
86
|
+
setPlaces([]);
|
|
87
|
+
setActive(-1);
|
|
88
|
+
setFailure('');
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const query = value.trim();
|
|
92
|
+
if (!query) {
|
|
93
|
+
setStatus('idle');
|
|
94
|
+
setPlaces([]);
|
|
95
|
+
setActive(-1);
|
|
96
|
+
setFailure('');
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
setStatus('loading');
|
|
100
|
+
setFailure('');
|
|
101
|
+
const controller = new AbortController();
|
|
102
|
+
const timer = window.setTimeout(() => {
|
|
103
|
+
requestJson(`${GEOCODE_URL}?q=${encodeURIComponent(query)}`, { signal: controller.signal })
|
|
104
|
+
.then((payload) => {
|
|
105
|
+
if (controller.signal.aborted) return;
|
|
106
|
+
const next = readPlaces(payload);
|
|
107
|
+
setPlaces(next);
|
|
108
|
+
setStatus('ready');
|
|
109
|
+
setActive(next.length ? 0 : -1);
|
|
110
|
+
})
|
|
111
|
+
.catch((error: unknown) => {
|
|
112
|
+
if (controller.signal.aborted) return;
|
|
113
|
+
setPlaces([]);
|
|
114
|
+
setStatus('error');
|
|
115
|
+
setActive(-1);
|
|
116
|
+
setFailure(describeError(error));
|
|
117
|
+
});
|
|
118
|
+
}, 280);
|
|
119
|
+
return () => {
|
|
120
|
+
window.clearTimeout(timer);
|
|
121
|
+
controller.abort();
|
|
122
|
+
};
|
|
123
|
+
}, [open, disabled, value]);
|
|
124
|
+
|
|
125
|
+
const visible = open && !disabled && value.trim().length > 0;
|
|
126
|
+
|
|
127
|
+
const choose = (place: GeocodePlace): void => {
|
|
128
|
+
onSelect(place);
|
|
129
|
+
setOpen(false);
|
|
130
|
+
inputRef.current?.blur();
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const pickActive = (): void => {
|
|
134
|
+
if (active >= 0 && places[active]) choose(places[active]);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
return h('div', { className: 'drc-field drc-city', ref: wrapRef },
|
|
138
|
+
h('span', null, t('locationName')),
|
|
139
|
+
h('input', {
|
|
140
|
+
ref: inputRef,
|
|
141
|
+
value,
|
|
142
|
+
disabled,
|
|
143
|
+
placeholder: t('citySearchPlaceholder'),
|
|
144
|
+
autoComplete: 'off',
|
|
145
|
+
spellCheck: false,
|
|
146
|
+
role: 'combobox',
|
|
147
|
+
'aria-expanded': visible,
|
|
148
|
+
'aria-autocomplete': 'list',
|
|
149
|
+
'aria-controls': 'drc-city-options',
|
|
150
|
+
onChange: (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
151
|
+
setOpen(true);
|
|
152
|
+
onChange(event.target.value);
|
|
153
|
+
},
|
|
154
|
+
onFocus: () => {
|
|
155
|
+
if (!disabled && value.trim()) setOpen(true);
|
|
156
|
+
},
|
|
157
|
+
onKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => {
|
|
158
|
+
if (event.key === 'Tab') {
|
|
159
|
+
setOpen(false);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (event.key === 'ArrowDown') {
|
|
163
|
+
event.preventDefault();
|
|
164
|
+
if (!visible) setOpen(true);
|
|
165
|
+
else if (places.length) setActive((current) => (current + 1) % places.length);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (event.key === 'ArrowUp') {
|
|
169
|
+
event.preventDefault();
|
|
170
|
+
if (visible && places.length) setActive((current) => (current <= 0 ? places.length - 1 : current - 1));
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (event.key === 'Enter') {
|
|
174
|
+
if (visible && active >= 0) {
|
|
175
|
+
event.preventDefault();
|
|
176
|
+
pickActive();
|
|
177
|
+
}
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (event.key === 'Escape' && visible) {
|
|
181
|
+
event.preventDefault();
|
|
182
|
+
setOpen(false);
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
}),
|
|
186
|
+
visible
|
|
187
|
+
? h('div', { className: 'drc-city-menu', id: 'drc-city-options', role: 'listbox', 'aria-label': t('locationName') },
|
|
188
|
+
status === 'loading'
|
|
189
|
+
? h('div', { className: 'drc-city-empty' }, t('citySearching'))
|
|
190
|
+
: status === 'error'
|
|
191
|
+
? h('div', { className: 'drc-city-empty is-error' },
|
|
192
|
+
h('span', { className: 'drc-city-error-title' },
|
|
193
|
+
/\b404\b/.test(failure) ? t('citySearchUnavailable') : t('citySearchFailed')),
|
|
194
|
+
failure ? h('span', { className: 'drc-city-error-detail' }, failure) : null,
|
|
195
|
+
)
|
|
196
|
+
: status === 'ready' && places.length === 0
|
|
197
|
+
? h('div', { className: 'drc-city-empty' }, t('cityNoResults'))
|
|
198
|
+
: places.map((place, index) => h('button', {
|
|
199
|
+
key: `${place.id ?? 'city'}-${place.latitude}-${place.longitude}-${index}`,
|
|
200
|
+
type: 'button',
|
|
201
|
+
role: 'option',
|
|
202
|
+
'aria-selected': index === active,
|
|
203
|
+
className: `drc-city-option${index === active ? ' is-active' : ''}`,
|
|
204
|
+
onMouseEnter: () => setActive(index),
|
|
205
|
+
onClick: () => choose(place),
|
|
206
|
+
},
|
|
207
|
+
h('span', { className: 'drc-city-name' }, place.name),
|
|
208
|
+
placeMeta(place) ? h('span', { className: 'drc-city-meta' }, placeMeta(place)) : null,
|
|
209
|
+
)),
|
|
210
|
+
)
|
|
211
|
+
: null,
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function locationGroup(api: PanelApi): React.ReactElement {
|
|
216
|
+
const { t, locationResult, locationBusy, busy, requestLocation } = api;
|
|
217
|
+
return h('div', { className: 'drc-group' },
|
|
218
|
+
groupHead(t('locationPermission'), t('locationPermissionHint')),
|
|
219
|
+
h('div', { className: 'drc-actions' },
|
|
220
|
+
h(Btn, { primary: true, disabled: locationBusy || busy, onClick: () => void requestLocation() }, locationBusy ? t('locationRequesting') : t('locationRequest')),
|
|
221
|
+
locationResult ? h('span', { className: 'drc-row-desc' }, `${t('locationStatus')} · ${accessLabel(t, locationResult.access)}`) : null,
|
|
222
|
+
),
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export function renderWeather(api: PanelApi): React.ReactElement {
|
|
227
|
+
const { t, settings, draft, setDraft, stage } = api;
|
|
228
|
+
const manual = (settings.weather?.mode ?? 'auto') === 'manual';
|
|
229
|
+
const choosePlace = (place: GeocodePlace): void => {
|
|
230
|
+
setDraft((current) => ({
|
|
231
|
+
...current,
|
|
232
|
+
locationName: place.name,
|
|
233
|
+
latitude: place.latitude.toFixed(4),
|
|
234
|
+
longitude: place.longitude.toFixed(4),
|
|
235
|
+
}));
|
|
236
|
+
};
|
|
237
|
+
return h('div', { className: 'drc-section' },
|
|
238
|
+
sectionHead(t('weather'), t('weatherPageHint')),
|
|
239
|
+
locationGroup(api),
|
|
240
|
+
h('div', { className: 'drc-group' },
|
|
241
|
+
groupHead(t('weatherSource'), t('weatherHint')),
|
|
242
|
+
h('div', { className: 'drc-actions' },
|
|
243
|
+
h(Seg, {
|
|
244
|
+
options: [{ value: 'auto', label: t('auto') }, { value: 'manual', label: t('manual') }],
|
|
245
|
+
value: settings.weather?.mode ?? 'auto',
|
|
246
|
+
onChange: (value) => stage({ weather: { mode: value } }),
|
|
247
|
+
}),
|
|
248
|
+
),
|
|
249
|
+
h('div', { className: 'drc-divider' }),
|
|
250
|
+
h('div', { className: 'drc-fields' },
|
|
251
|
+
h(CitySearch, {
|
|
252
|
+
t,
|
|
253
|
+
value: draft.locationName,
|
|
254
|
+
disabled: !manual,
|
|
255
|
+
onChange: (value) => setDraft((current) => ({ ...current, locationName: value })),
|
|
256
|
+
onSelect: choosePlace,
|
|
257
|
+
}),
|
|
258
|
+
h(Field, { label: t('latitude'), value: draft.latitude, placeholder: '0.0000', inputMode: 'decimal', disabled: !manual, onChange: (value) => setDraft((current) => ({ ...current, latitude: value })) }),
|
|
259
|
+
h(Field, { label: t('longitude'), value: draft.longitude, placeholder: '0.0000', inputMode: 'decimal', disabled: !manual, onChange: (value) => setDraft((current) => ({ ...current, longitude: value })) }),
|
|
260
|
+
),
|
|
261
|
+
h('div', { className: 'drc-actions' },
|
|
262
|
+
h('span', { className: 'drc-row-desc' }, manual ? t('citySearchHint') : t('locationAutoHint')),
|
|
263
|
+
),
|
|
264
|
+
),
|
|
265
|
+
h('div', { className: 'drc-group' },
|
|
266
|
+
groupHead(t('forecastDisplay'), t('forecastDisplayHint')),
|
|
267
|
+
h('div', { className: 'drc-actions' },
|
|
268
|
+
h(Seg, {
|
|
269
|
+
options: [{ value: 'hourly', label: t('hourly') }, { value: 'daily', label: t('daily') }],
|
|
270
|
+
value: settings.weather?.forecastMode ?? 'hourly',
|
|
271
|
+
onChange: (value) => stage({ weather: { forecastMode: value } }),
|
|
272
|
+
}),
|
|
273
|
+
),
|
|
274
|
+
),
|
|
275
|
+
);
|
|
276
|
+
}
|