diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55216e09..ecf835e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,4 +30,4 @@ jobs: - name: Run JS Tests run: vp test - name: Run Rust Tests - run: cargo test --all + run: cargo test --all --features yaak-app-client/wry diff --git a/.github/workflows/release-app.yml b/.github/workflows/release-app.yml index 5e128331..c6198625 100644 --- a/.github/workflows/release-app.yml +++ b/.github/workflows/release-app.yml @@ -14,33 +14,33 @@ jobs: matrix: include: - platform: "macos-latest" # for Arm-based Macs (M1 and above). - args: "--target aarch64-apple-darwin" + args: '--target aarch64-apple-darwin --config ./tauri.release.conf.json --config ''{"build":{"features":["updater","license","wry"]}}''' yaak_arch: "arm64" os: "macos" targets: "aarch64-apple-darwin" - platform: "macos-latest" # for Intel-based Macs. - args: "--target x86_64-apple-darwin" + args: '--target x86_64-apple-darwin --config ./tauri.release.conf.json --config ''{"build":{"features":["updater","license","wry"]}}''' yaak_arch: "x64" os: "macos" targets: "x86_64-apple-darwin" - platform: "ubuntu-22.04" - args: "" + args: '--config ./tauri.release.conf.json --config ''{"build":{"features":["updater","license","cef"]}}''' yaak_arch: "x64" os: "ubuntu" targets: "" - platform: "ubuntu-22.04-arm" - args: "" + args: '--config ./tauri.release.conf.json --config ''{"build":{"features":["updater","license","cef"]}}''' yaak_arch: "arm64" os: "ubuntu" targets: "" - platform: "windows-latest" - args: "" + args: '--config ./tauri.release.conf.json --config ''{"build":{"features":["updater","license","wry"]}}''' yaak_arch: "x64" os: "windows" targets: "" # Windows ARM64 - platform: "windows-latest" - args: "--target aarch64-pc-windows-msvc" + args: '--target aarch64-pc-windows-msvc --config ./tauri.release.conf.json --config ''{"build":{"features":["updater","license","wry"]}}''' yaak_arch: "arm64" os: "windows" targets: "aarch64-pc-windows-msvc" @@ -66,11 +66,18 @@ jobs: shared-key: ci cache-on-failure: true + - name: Cache CEF (Linux only) + if: matrix.os == 'ubuntu' + uses: actions/cache@v4 + with: + path: ~/.cache/tauri-cef + key: cef-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Cargo.lock') }} + - name: install dependencies (Linux only) if: matrix.os == 'ubuntu' run: | sudo apt-get update - sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf xdg-utils + sudo apt-get install -y cmake ninja-build libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf xdg-utils - name: Install Protoc for plugin-runtime uses: arduino/setup-protoc@v3 @@ -98,7 +105,7 @@ jobs: - name: Run JS Tests run: vp test - name: Run Rust Tests - run: cargo test --all --exclude yaak-cli + run: cargo test --all --exclude yaak-cli --features yaak-app-client/wry - name: Set version run: npm run replace-version @@ -150,13 +157,14 @@ jobs: AZURE_CLIENT_SECRET: ${{ matrix.os == 'windows' && secrets.AZURE_CLIENT_SECRET }} AZURE_TENANT_ID: ${{ matrix.os == 'windows' && secrets.AZURE_TENANT_ID }} with: + tauriScript: "node ../../node_modules/@tauri-apps/cli/tauri.js" tagName: "v__VERSION__" releaseName: "Release __VERSION__" releaseBody: "[Changelog __VERSION__](https://yaak.app/blog/__VERSION__)" releaseDraft: true prerelease: true projectPath: ./crates-tauri/yaak-app-client - args: "${{ matrix.args }} --config ./tauri.release.conf.json" + args: "${{ matrix.args }}" # Build a per-machine NSIS installer for enterprise deployment (PDQ, SCCM, Intune) - name: Build and upload machine-wide installer (Windows only) @@ -173,7 +181,7 @@ jobs: run: | Get-ChildItem -Recurse -Path target -File -Filter "*.exe.sig" | Remove-Item -Force Push-Location crates-tauri/yaak-app-client - npx tauri bundle ${{ matrix.args }} --bundles nsis --config ./tauri.release.conf.json --config '{"bundle":{"createUpdaterArtifacts":true,"windows":{"nsis":{"installMode":"perMachine"}}}}' + npx tauri bundle ${{ matrix.args }} --bundles nsis --config '{"bundle":{"createUpdaterArtifacts":true,"windows":{"nsis":{"installMode":"perMachine"}}}}' Pop-Location $setup = Get-ChildItem -Recurse -Path target -Filter "*setup*.exe" | Select-Object -First 1 $setupSig = "$($setup.FullName).sig" diff --git a/Cargo.lock b/Cargo.lock index 81129d72..0e4df5f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -215,7 +215,7 @@ dependencies = [ "objc2-foundation 0.3.1", "parking_lot", "percent-encoding", - "windows-sys 0.52.0", + "windows-sys 0.59.0", "wl-clipboard-rs", "x11rb", ] @@ -238,6 +238,24 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +[[package]] +name = "ashpd" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3d60bee1a1d38c2077030f4788e1b4e31058d2e79a8cfc8f2b440bd44db290" +dependencies = [ + "async-fs", + "async-net", + "enumflags2", + "futures-channel", + "futures-util", + "rand 0.8.5", + "serde", + "serde_repr", + "url", + "zbus", +] + [[package]] name = "assert_cmd" version = "2.1.2" @@ -259,12 +277,23 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" dependencies = [ - "event-listener", + "event-listener 5.4.0", "event-listener-strategy", "futures-core", "pin-project-lite", ] +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener 2.5.3", + "futures-core", +] + [[package]] name = "async-channel" version = "2.3.1" @@ -307,6 +336,32 @@ dependencies = [ "slab", ] +[[package]] +name = "async-fs" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8034a681df4aed8b8edbd7fbe472401ecf009251c8b40556b304567052e294c5" +dependencies = [ + "async-lock", + "blocking", + "futures-lite", +] + +[[package]] +name = "async-global-executor" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" +dependencies = [ + "async-channel 2.3.1", + "async-executor", + "async-io", + "async-lock", + "blocking", + "futures-lite", + "once_cell", +] + [[package]] name = "async-io" version = "2.4.1" @@ -332,25 +387,36 @@ version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" dependencies = [ - "event-listener", + "event-listener 5.4.0", "event-listener-strategy", "pin-project-lite", ] +[[package]] +name = "async-net" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b948000fad4873c1c9339d60f2623323a0cfd3816e5181033c6a5cb68b2accf7" +dependencies = [ + "async-io", + "blocking", + "futures-lite", +] + [[package]] name = "async-process" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cde3f4e40e6021d7acffc90095cbd6dc54cb593903d1de5832f435eb274b85dc" dependencies = [ - "async-channel", + "async-channel 2.3.1", "async-io", "async-lock", "async-signal", "async-task", "blocking", "cfg-if", - "event-listener", + "event-listener 5.4.0", "futures-lite", "rustix 1.0.7", "tracing", @@ -396,6 +462,32 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "async-std" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c8e079a4ab67ae52b7403632e4618815d6db36d2a010cfe41b02c1b1578f93b" +dependencies = [ + "async-channel 1.9.0", + "async-global-executor", + "async-io", + "async-lock", + "crossbeam-utils", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite", + "gloo-timers", + "kv-log-macro", + "log 0.4.29", + "memchr", + "once_cell", + "pin-project-lite", + "pin-utils", + "slab", + "wasm-bindgen-futures", +] + [[package]] name = "async-stream" version = "0.3.6" @@ -677,7 +769,7 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea" dependencies = [ - "async-channel", + "async-channel 2.3.1", "async-task", "futures-io", "futures-lite", @@ -838,6 +930,15 @@ dependencies = [ "bzip2-sys", ] +[[package]] +name = "bzip2" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c" +dependencies = [ + "libbz2-rs-sys", +] + [[package]] name = "bzip2-sys" version = "0.1.13+1.0.8" @@ -944,6 +1045,30 @@ dependencies = [ "shlex", ] +[[package]] +name = "cef" +version = "148.0.0+147.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2445d2f1e820efc064c511faa3a07c3ee79e565fdae026ca62ed3c80d0459223" +dependencies = [ + "cef-dll-sys", + "libloading 0.9.0", + "objc2 0.6.4", + "windows-sys 0.61.2", +] + +[[package]] +name = "cef-dll-sys" +version = "148.0.0+147.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d32a7c89af6c77688ad58dc75555c9398c5ded2c328a3ff83554fccc840af57" +dependencies = [ + "anyhow", + "cmake", + "download-cef", + "serde_json", +] + [[package]] name = "cesu8" version = "1.1.0" @@ -1151,7 +1276,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" dependencies = [ "lazy_static 1.5.0", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -1219,6 +1344,18 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "console" +version = "0.16.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fe5f465a4f6fee88fad41b85d990f84c835335e85b5d9e6e63e0d06d28cba7c" +dependencies = [ + "encode_unicode", + "libc", + "unicode-width 0.2.2", + "windows-sys 0.61.2", +] + [[package]] name = "const-random" version = "0.1.18" @@ -1251,6 +1388,12 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + [[package]] name = "convert_case" version = "0.10.0" @@ -1266,10 +1409,29 @@ version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" dependencies = [ + "percent-encoding", "time", "version_check", ] +[[package]] +name = "cookie_store" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15b2c103cf610ec6cae3da84a766285b42fd16aad564758459e6ecf128c75206" +dependencies = [ + "cookie", + "document-features", + "idna", + "indexmap 2.14.0", + "log 0.4.29", + "serde", + "serde_derive", + "serde_json", + "time", + "url", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -1493,6 +1655,23 @@ dependencies = [ "phf 0.11.3", ] +[[package]] +name = "cssparser" +version = "0.29.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93d03419cb5950ccfd3daf3ff1c7a36ace64609a1a8746d493df1ca0afde0fa" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "matches", + "phf 0.10.1", + "proc-macro2", + "quote", + "smallvec", + "syn 1.0.109", +] + [[package]] name = "cssparser" version = "0.36.0" @@ -1532,6 +1711,20 @@ version = "0.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52560adf09603e58c9a7ee1fe1dcb95a16927b17c127f0ac02d6e768a0e25bc1" +[[package]] +name = "dark-light" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18e1a09f280e29a8b00bc7e81eca5ac87dca0575639c9422a5fa25a07bb884b8" +dependencies = [ + "ashpd", + "async-std", + "objc2 0.5.2", + "objc2-foundation 0.2.2", + "web-sys", + "winreg 0.52.0", +] + [[package]] name = "darling" version = "0.20.11" @@ -1635,6 +1828,19 @@ dependencies = [ "syn 2.0.101", ] +[[package]] +name = "derive_more" +version = "0.99.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6edb4b64a43d977b8e99788fe3a04d483834fba1215a7e02caa415b626497f7f" +dependencies = [ + "convert_case 0.4.0", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.101", +] + [[package]] name = "derive_more" version = "2.1.1" @@ -1650,7 +1856,7 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" dependencies = [ - "convert_case", + "convert_case 0.10.0", "proc-macro2", "quote", "rustc_version", @@ -1684,6 +1890,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "dioxus-debug-cell" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ea539174bb236e0e7dc9c12b19b88eae3cb574dedbd0252a2d43ea7e6de13e2" + [[package]] name = "dirs" version = "6.0.0" @@ -1760,6 +1972,15 @@ dependencies = [ "const-random", ] +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + [[package]] name = "dom_query" version = "0.27.0" @@ -1767,12 +1988,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "521e380c0c8afb8d9a1e83a1822ee03556fc3e3e7dbc1fd30be14e37f9cb3f89" dependencies = [ "bit-set", - "cssparser", + "cssparser 0.36.0", "foldhash 0.2.0", - "html5ever", + "html5ever 0.38.0", "precomputed-hash", - "selectors", - "tendril", + "selectors 0.36.1", + "tendril 0.5.0", ] [[package]] @@ -1781,6 +2002,26 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" +[[package]] +name = "download-cef" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c169adf067a787e1f1c58ed62906a557de85388bee4b54fb878b722ff606b113" +dependencies = [ + "bzip2 0.6.1", + "clap", + "fs-err", + "indicatif", + "regex 1.11.1", + "semver", + "serde", + "serde_json", + "sha1_smol", + "tar", + "thiserror 2.0.17", + "ureq", +] + [[package]] name = "dpi" version = "0.1.2" @@ -1970,7 +2211,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1979,6 +2220,12 @@ version = "3.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dea2df4cf52843e0452895c455a1a2cfbb842a1e7329671acf418fdc53ed4c59" +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + [[package]] name = "event-listener" version = "5.4.0" @@ -1996,7 +2243,7 @@ version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" dependencies = [ - "event-listener", + "event-listener 5.4.0", "pin-project-lite", ] @@ -2223,6 +2470,15 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "fs-err" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73fde052dbfc920003cfd2c8e2c6e6d4cc7c1091538c3a24226cec0665ab08c0" +dependencies = [ + "autocfg", +] + [[package]] name = "fs_extra" version = "1.3.0" @@ -2244,6 +2500,16 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" +[[package]] +name = "futf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" +dependencies = [ + "mac", + "new_debug_unreachable", +] + [[package]] name = "futures" version = "0.3.31" @@ -2493,6 +2759,17 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + [[package]] name = "getrandom" version = "0.2.16" @@ -2618,6 +2895,18 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +[[package]] +name = "gloo-timers" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + [[package]] name = "gobject-sys" version = "0.18.0" @@ -2810,6 +3099,18 @@ dependencies = [ "digest", ] +[[package]] +name = "html5ever" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b7410cae13cbc75623c98ac4cbfd1f0bedddf3227afc24f370cf0f50a44a11c" +dependencies = [ + "log 0.4.29", + "mac", + "markup5ever 0.14.1", + "match_token", +] + [[package]] name = "html5ever" version = "0.38.0" @@ -2817,7 +3118,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1054432bae2f14e0061e33d23402fbaa67a921d319d56adc6bcf887ddad1cbc2" dependencies = [ "log 0.4.29", - "markup5ever", + "markup5ever 0.38.0", ] [[package]] @@ -3166,6 +3467,19 @@ dependencies = [ "serde_core", ] +[[package]] +name = "indicatif" +version = "0.18.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9433806cd6b4ec1aba79c021c7e4c58fb4c3b9977c085062e611ac929998fb0c" +dependencies = [ + "console 0.16.4", + "portable-atomic", + "unicode-width 0.2.2", + "unit-prefix", + "web-time", +] + [[package]] name = "infer" version = "0.19.0" @@ -3476,6 +3790,27 @@ dependencies = [ "libc", ] +[[package]] +name = "kuchikiki" +version = "0.8.8-speedreader" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02cb977175687f33fa4afa0c95c112b987ea1443e5a51c8f8ff27dc618270cc2" +dependencies = [ + "cssparser 0.29.6", + "html5ever 0.29.1", + "indexmap 2.14.0", + "selectors 0.24.0", +] + +[[package]] +name = "kv-log-macro" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" +dependencies = [ + "log 0.4.29", +] + [[package]] name = "lazy_static" version = "0.2.11" @@ -3508,10 +3843,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e9ec52138abedcc58dc17a7c6c0c00a2bdb4f3427c7f63fa97fd0d859155caf" dependencies = [ "gtk-sys", - "libloading", + "libloading 0.7.4", "once_cell", ] +[[package]] +name = "libbz2-rs-sys" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34b357333733e8260735ba5894eb928c02ecc69c78715f01a8019e7fa7f2db4c" + [[package]] name = "libc" version = "0.2.172" @@ -3551,6 +3892,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "libloading" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "754ca22de805bb5744484a5b151a9e1a8e837d5dc232c2d7d8c2e3492edc8b60" +dependencies = [ + "cfg-if", + "windows-link 0.2.1", +] + [[package]] name = "liblzma" version = "0.4.1" @@ -3646,6 +3997,12 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" +[[package]] +name = "litrs" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" + [[package]] name = "lock_api" version = "0.4.13" @@ -3674,6 +4031,12 @@ dependencies = [ "value-bag", ] +[[package]] +name = "mac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" + [[package]] name = "malloc_buf" version = "0.0.6" @@ -3683,6 +4046,20 @@ dependencies = [ "libc", ] +[[package]] +name = "markup5ever" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7a7213d12e1864c0f002f52c2923d4556935a43dec5e71355c2760e0f6e7a18" +dependencies = [ + "log 0.4.29", + "phf 0.11.3", + "phf_codegen 0.11.3", + "string_cache 0.8.9", + "string_cache_codegen 0.5.4", + "tendril 0.4.3", +] + [[package]] name = "markup5ever" version = "0.38.0" @@ -3690,10 +4067,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8983d30f2915feeaaab2d6babdd6bc7e9ed1a00b66b5e6d74df19aa9c0e91862" dependencies = [ "log 0.4.29", - "tendril", + "tendril 0.5.0", "web_atoms", ] +[[package]] +name = "match_token" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88a9689d8d44bf9964484516275f5cd4c9b59457a6940c1d5d0ecbb94510a36b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "matches" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" + [[package]] name = "matchit" version = "0.7.3" @@ -3931,6 +4325,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5eb86a92577833b75522336f210c49d9ebd7dd55a44d80a92e68c668a75f27c" +[[package]] +name = "nodrop" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" + [[package]] name = "nom" version = "7.1.3" @@ -4103,10 +4503,15 @@ checksum = "e6f29f568bec459b0ddff777cec4fe3fd8666d82d5a40ebd0ff7e66134f89bcc" dependencies = [ "bitflags 2.11.0", "block2 0.6.1", + "libc", "objc2 0.6.4", + "objc2-cloud-kit", + "objc2-core-data", "objc2-core-foundation", "objc2-core-graphics", + "objc2-core-image", "objc2-foundation 0.3.1", + "objc2-quartz-core 0.3.1", ] [[package]] @@ -4126,6 +4531,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "291fbbf7d29287518e8686417cf7239c74700fd4b607623140a7d4a3c834329d" dependencies = [ + "bitflags 2.11.0", "objc2 0.6.4", "objc2-foundation 0.3.1", ] @@ -4225,6 +4631,16 @@ dependencies = [ "objc2-core-foundation", ] +[[package]] +name = "objc2-javascript-core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9052cb1bb50a4c161d934befcf879526fb87ae9a68858f241e693ca46225cf5a" +dependencies = [ + "objc2 0.6.4", + "objc2-core-foundation", +] + [[package]] name = "objc2-metal" version = "0.2.2" @@ -4274,6 +4690,17 @@ dependencies = [ "objc2-foundation 0.3.1", ] +[[package]] +name = "objc2-security" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1f8e0ef3ab66b08c42644dcb34dba6ec0a574bbd8adbb8bdbdc7a2779731a44" +dependencies = [ + "bitflags 2.11.0", + "objc2 0.6.4", + "objc2-core-foundation", +] + [[package]] name = "objc2-ui-kit" version = "0.3.1" @@ -4316,6 +4743,8 @@ dependencies = [ "objc2-app-kit", "objc2-core-foundation", "objc2-foundation 0.3.1", + "objc2-javascript-core", + "objc2-security", ] [[package]] @@ -5119,6 +5548,26 @@ dependencies = [ "serde", ] +[[package]] +name = "phf" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" +dependencies = [ + "phf_shared 0.8.0", +] + +[[package]] +name = "phf" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +dependencies = [ + "phf_macros 0.10.0", + "phf_shared 0.10.0", + "proc-macro-hack", +] + [[package]] name = "phf" version = "0.11.3" @@ -5140,6 +5589,26 @@ dependencies = [ "serde", ] +[[package]] +name = "phf_codegen" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815" +dependencies = [ + "phf_generator 0.8.0", + "phf_shared 0.8.0", +] + +[[package]] +name = "phf_codegen" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" +dependencies = [ + "phf_generator 0.11.3", + "phf_shared 0.11.3", +] + [[package]] name = "phf_codegen" version = "0.13.1" @@ -5150,6 +5619,26 @@ dependencies = [ "phf_shared 0.13.1", ] +[[package]] +name = "phf_generator" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" +dependencies = [ + "phf_shared 0.8.0", + "rand 0.7.3", +] + +[[package]] +name = "phf_generator" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +dependencies = [ + "phf_shared 0.10.0", + "rand 0.8.5", +] + [[package]] name = "phf_generator" version = "0.11.3" @@ -5170,6 +5659,20 @@ dependencies = [ "phf_shared 0.13.1", ] +[[package]] +name = "phf_macros" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", + "proc-macro-hack", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "phf_macros" version = "0.11.3" @@ -5196,13 +5699,31 @@ dependencies = [ "syn 2.0.101", ] +[[package]] +name = "phf_shared" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" +dependencies = [ + "siphasher 0.3.11", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher 0.3.11", +] + [[package]] name = "phf_shared" version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" dependencies = [ - "siphasher", + "siphasher 1.0.1", ] [[package]] @@ -5211,7 +5732,7 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" dependencies = [ - "siphasher", + "siphasher 1.0.1", ] [[package]] @@ -5498,6 +6019,12 @@ dependencies = [ "version_check", ] +[[package]] +name = "proc-macro-hack" +version = "0.5.20+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" + [[package]] name = "proc-macro2" version = "1.0.95" @@ -5662,6 +6189,20 @@ dependencies = [ "nibble_vec", ] +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", + "rand_pcg", +] + [[package]] name = "rand" version = "0.8.5" @@ -5683,6 +6224,16 @@ dependencies = [ "rand_core 0.9.3", ] +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + [[package]] name = "rand_chacha" version = "0.3.1" @@ -5703,6 +6254,15 @@ dependencies = [ "rand_core 0.9.3", ] +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -5721,6 +6281,24 @@ dependencies = [ "getrandom 0.3.3", ] +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rand_pcg" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +dependencies = [ + "rand_core 0.5.1", +] + [[package]] name = "raw-window-handle" version = "0.6.2" @@ -6044,7 +6622,7 @@ dependencies = [ "bitflags 2.11.0", "commondir", "css-module-lexer", - "derive_more", + "derive_more 2.1.1", "dunce", "futures", "indexmap 2.14.0", @@ -6154,7 +6732,7 @@ dependencies = [ "arcstr", "bitflags 2.11.0", "dashmap", - "derive_more", + "derive_more 2.1.1", "fast-glob", "itertools", "num-bigint", @@ -6235,7 +6813,7 @@ dependencies = [ "anyhow", "arcstr", "bitflags 2.11.0", - "derive_more", + "derive_more 2.1.1", "heck 0.5.0", "oxc", "oxc_resolver", @@ -6267,7 +6845,7 @@ dependencies = [ "async-trait", "bitflags 2.11.0", "dashmap", - "derive_more", + "derive_more 2.1.1", "oxc_index", "rolldown_common", "rolldown_debug", @@ -6534,7 +7112,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.4.15", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -6547,7 +7125,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.9.4", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -6683,7 +7261,22 @@ dependencies = [ "chrono", "dyn-clone", "indexmap 1.9.3", - "schemars_derive", + "schemars_derive 0.8.22", + "serde", + "serde_json", + "url", + "uuid", +] + +[[package]] +name = "schemars" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc" +dependencies = [ + "dyn-clone", + "ref-cast", + "schemars_derive 1.2.1", "serde", "serde_json", "url", @@ -6702,6 +7295,18 @@ dependencies = [ "syn 2.0.101", ] +[[package]] +name = "schemars_derive" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d115b50f4aaeea07e79c1912f645c7513d81715d0420f8bc77a18c6260b307f" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 2.0.101", +] + [[package]] name = "scopeguard" version = "1.2.0" @@ -6795,6 +7400,24 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "selectors" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c37578180969d00692904465fb7f6b3d50b9a2b952b87c23d0e2e5cb5013416" +dependencies = [ + "bitflags 1.3.2", + "cssparser 0.29.6", + "derive_more 0.99.20", + "fxhash", + "log 0.4.29", + "phf 0.8.0", + "phf_codegen 0.8.0", + "precomputed-hash", + "servo_arc 0.2.0", + "smallvec", +] + [[package]] name = "selectors" version = "0.36.1" @@ -6802,15 +7425,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5d9c0c92a92d33f08817311cf3f2c29a3538a8240e94a6a3c622ce652d7e00c" dependencies = [ "bitflags 2.11.0", - "cssparser", - "derive_more", + "cssparser 0.36.0", + "derive_more 2.1.1", "log 0.4.29", "new_debug_unreachable", "phf 0.13.1", - "phf_codegen", + "phf_codegen 0.13.1", "precomputed-hash", "rustc-hash 2.1.1", - "servo_arc", + "servo_arc 0.4.3", "smallvec", ] @@ -7060,6 +7683,16 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "servo_arc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52aa42f8fdf0fed91e5ce7f23d8138441002fa31dca008acf47e6fd4721f741" +dependencies = [ + "nodrop", + "stable_deref_trait", +] + [[package]] name = "servo_arc" version = "0.4.3" @@ -7080,6 +7713,12 @@ dependencies = [ "digest", ] +[[package]] +name = "sha1_smol" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d" + [[package]] name = "sha2" version = "0.10.9" @@ -7170,6 +7809,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + [[package]] name = "siphasher" version = "1.0.1" @@ -7217,6 +7862,17 @@ dependencies = [ "windows-sys 0.60.2", ] +[[package]] +name = "socks" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c3dbbd9ae980613c6dd8e28a9407b50509d3803b57624d5dfe8315218cd58b" +dependencies = [ + "byteorder", + "libc", + "winapi", +] + [[package]] name = "softbuffer" version = "0.4.6" @@ -7283,6 +7939,19 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d08889ec5408683408db66ad89e0e1f93dff55c73a4ccc71c427d5b277ee47e6" +[[package]] +name = "string_cache" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared 0.11.3", + "precomputed-hash", + "serde", +] + [[package]] name = "string_cache" version = "0.9.0" @@ -7295,6 +7964,18 @@ dependencies = [ "precomputed-hash", ] +[[package]] +name = "string_cache_codegen" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c711928715f1fe0fe509c53b43e993a9a557babc2d0a3567d0a3006f1ac931a0" +dependencies = [ + "phf_generator 0.11.3", + "phf_shared 0.11.3", + "proc-macro2", + "quote", +] + [[package]] name = "string_cache_codegen" version = "0.6.1" @@ -7526,8 +8207,7 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tauri" version = "2.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b93bd86d231f0a8138f11a02a584769fe4b703dc36ae133d783228dbc4801405" +source = "git+https://github.com/tauri-apps/tauri?rev=d9bc695c18d9a25baec21d8a5f36d72e3a14ee53#d9bc695c18d9a25baec21d8a5f36d72e3a14ee53" dependencies = [ "anyhow", "bytes", @@ -7563,8 +8243,9 @@ dependencies = [ "tauri-build", "tauri-macros", "tauri-runtime", + "tauri-runtime-cef", "tauri-runtime-wry", - "tauri-utils", + "tauri-utils 2.9.1 (git+https://github.com/tauri-apps/tauri?rev=d9bc695c18d9a25baec21d8a5f36d72e3a14ee53)", "thiserror 2.0.17", "tokio", "tray-icon", @@ -7578,8 +8259,7 @@ dependencies = [ [[package]] name = "tauri-build" version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a318b234cc2dea65f575467bafcfb76286bce228ebc3778e337d61d03213007" +source = "git+https://github.com/tauri-apps/tauri?rev=d9bc695c18d9a25baec21d8a5f36d72e3a14ee53#d9bc695c18d9a25baec21d8a5f36d72e3a14ee53" dependencies = [ "anyhow", "cargo_toml", @@ -7587,11 +8267,11 @@ dependencies = [ "glob", "heck 0.5.0", "json-patch", - "schemars", + "schemars 1.2.1", "semver", "serde", "serde_json", - "tauri-utils", + "tauri-utils 2.9.1 (git+https://github.com/tauri-apps/tauri?rev=d9bc695c18d9a25baec21d8a5f36d72e3a14ee53)", "tauri-winres", "walkdir", ] @@ -7599,8 +8279,7 @@ dependencies = [ [[package]] name = "tauri-codegen" version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bd11644962add2549a60b7e7c6800f17d7020156e02f516021d8103e80cc528" +source = "git+https://github.com/tauri-apps/tauri?rev=d9bc695c18d9a25baec21d8a5f36d72e3a14ee53#d9bc695c18d9a25baec21d8a5f36d72e3a14ee53" dependencies = [ "base64 0.22.1", "brotli 8.0.1", @@ -7615,7 +8294,7 @@ dependencies = [ "serde_json", "sha2", "syn 2.0.101", - "tauri-utils", + "tauri-utils 2.9.1 (git+https://github.com/tauri-apps/tauri?rev=d9bc695c18d9a25baec21d8a5f36d72e3a14ee53)", "thiserror 2.0.17", "time", "url", @@ -7626,15 +8305,14 @@ dependencies = [ [[package]] name = "tauri-macros" version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed9d3742a37a355d2e47c9af924e9fbc112abb76f9835d35d4780e318419502" +source = "git+https://github.com/tauri-apps/tauri?rev=d9bc695c18d9a25baec21d8a5f36d72e3a14ee53#d9bc695c18d9a25baec21d8a5f36d72e3a14ee53" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", "syn 2.0.101", "tauri-codegen", - "tauri-utils", + "tauri-utils 2.9.1 (git+https://github.com/tauri-apps/tauri?rev=d9bc695c18d9a25baec21d8a5f36d72e3a14ee53)", ] [[package]] @@ -7646,10 +8324,10 @@ dependencies = [ "anyhow", "glob", "plist", - "schemars", + "schemars 0.8.22", "serde", "serde_json", - "tauri-utils", + "tauri-utils 2.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir", ] @@ -7681,7 +8359,7 @@ dependencies = [ "serde_json", "tauri", "tauri-plugin", - "tauri-utils", + "tauri-utils 2.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 2.0.17", "tracing", "url", @@ -7719,13 +8397,13 @@ dependencies = [ "log 0.4.29", "objc2-foundation 0.3.1", "percent-encoding", - "schemars", + "schemars 0.8.22", "serde", "serde_json", "serde_repr", "tauri", "tauri-plugin", - "tauri-utils", + "tauri-utils 2.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 2.0.17", "toml 1.1.2+spec-1.1.0", "url", @@ -7764,7 +8442,7 @@ dependencies = [ "objc2-app-kit", "objc2-foundation 0.3.1", "open", - "schemars", + "schemars 0.8.22", "serde", "serde_json", "tauri", @@ -7804,7 +8482,7 @@ dependencies = [ "open", "os_pipe", "regex 1.11.1", - "schemars", + "schemars 0.8.22", "serde", "serde_json", "shared_child", @@ -7866,8 +8544,7 @@ dependencies = [ [[package]] name = "tauri-runtime" version = "2.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fef478ba1d2ac21c2d528740b24d0cb315e1e8b1111aae53fafac34804371fc" +source = "git+https://github.com/tauri-apps/tauri?rev=d9bc695c18d9a25baec21d8a5f36d72e3a14ee53#d9bc695c18d9a25baec21d8a5f36d72e3a14ee53" dependencies = [ "cookie", "dpi", @@ -7876,23 +8553,48 @@ dependencies = [ "jni", "objc2 0.6.4", "objc2-ui-kit", - "objc2-web-kit", "raw-window-handle", "serde", "serde_json", - "tauri-utils", + "tauri-utils 2.9.1 (git+https://github.com/tauri-apps/tauri?rev=d9bc695c18d9a25baec21d8a5f36d72e3a14ee53)", "thiserror 2.0.17", "url", - "webkit2gtk", - "webview2-com", "windows 0.61.1", ] +[[package]] +name = "tauri-runtime-cef" +version = "0.1.0" +source = "git+https://github.com/tauri-apps/tauri?rev=d9bc695c18d9a25baec21d8a5f36d72e3a14ee53#d9bc695c18d9a25baec21d8a5f36d72e3a14ee53" +dependencies = [ + "base64 0.22.1", + "cef", + "cef-dll-sys", + "dioxus-debug-cell", + "dirs", + "gtk", + "html5ever 0.29.1", + "http", + "kuchikiki", + "log 0.4.29", + "objc2 0.6.4", + "objc2-app-kit", + "objc2-foundation 0.3.1", + "raw-window-handle", + "serde", + "serde_json", + "sha2", + "tauri-runtime", + "tauri-utils 2.9.1 (git+https://github.com/tauri-apps/tauri?rev=d9bc695c18d9a25baec21d8a5f36d72e3a14ee53)", + "url", + "windows 0.61.1", + "x11-dl", +] + [[package]] name = "tauri-runtime-wry" version = "2.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3989df2ae1c476404fe0a2e8ffc4cfbde97e51efd613c2bb5355fbc9ab52cf0" +source = "git+https://github.com/tauri-apps/tauri?rev=d9bc695c18d9a25baec21d8a5f36d72e3a14ee53#d9bc695c18d9a25baec21d8a5f36d72e3a14ee53" dependencies = [ "gtk", "http", @@ -7900,13 +8602,14 @@ dependencies = [ "log 0.4.29", "objc2 0.6.4", "objc2-app-kit", + "objc2-web-kit", "once_cell", "percent-encoding", "raw-window-handle", "softbuffer", "tao", "tauri-runtime", - "tauri-utils", + "tauri-utils 2.9.1 (git+https://github.com/tauri-apps/tauri?rev=d9bc695c18d9a25baec21d8a5f36d72e3a14ee53)", "url", "webkit2gtk", "webview2-com", @@ -7921,7 +8624,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d57200389a2f82b4b0a40ae29ca19b6978116e8f4d4e974c3234ce40c0ffbdec" dependencies = [ "anyhow", - "brotli 8.0.1", "cargo_metadata", "ctor", "dom_query", @@ -7937,7 +8639,7 @@ dependencies = [ "proc-macro2", "quote", "regex 1.11.1", - "schemars", + "schemars 0.8.22", "semver", "serde", "serde-untagged", @@ -7945,7 +8647,45 @@ dependencies = [ "serde_with", "swift-rs", "thiserror 2.0.17", - "toml 0.9.5", + "toml 1.1.2+spec-1.1.0", + "url", + "urlpattern", + "uuid", +] + +[[package]] +name = "tauri-utils" +version = "2.9.1" +source = "git+https://github.com/tauri-apps/tauri?rev=d9bc695c18d9a25baec21d8a5f36d72e3a14ee53#d9bc695c18d9a25baec21d8a5f36d72e3a14ee53" +dependencies = [ + "anyhow", + "brotli 8.0.1", + "cargo_metadata", + "ctor", + "dom_query", + "dunce", + "glob", + "html5ever 0.29.1", + "http", + "infer", + "json-patch", + "kuchikiki", + "log 0.4.29", + "memchr", + "phf 0.13.1", + "plist", + "proc-macro2", + "quote", + "regex 1.11.1", + "schemars 1.2.1", + "semver", + "serde", + "serde-untagged", + "serde_json", + "serde_with", + "swift-rs", + "thiserror 2.0.17", + "toml 1.1.2+spec-1.1.0", "url", "urlpattern", "uuid", @@ -7973,7 +8713,18 @@ dependencies = [ "getrandom 0.3.3", "once_cell", "rustix 1.0.7", - "windows-sys 0.52.0", + "windows-sys 0.59.0", +] + +[[package]] +name = "tendril" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" +dependencies = [ + "futf", + "mac", + "utf-8", ] [[package]] @@ -8259,21 +9010,6 @@ dependencies = [ "toml_edit 0.22.27", ] -[[package]] -name = "toml" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75129e1dc5000bfbaa9fee9d1b21f974f9fbad9daec557a521ee6e080825f6e8" -dependencies = [ - "indexmap 2.14.0", - "serde", - "serde_spanned 1.1.1", - "toml_datetime 0.7.0", - "toml_parser", - "toml_writer", - "winnow 0.7.10", -] - [[package]] name = "toml" version = "1.1.2+spec-1.1.0" @@ -8298,15 +9034,6 @@ dependencies = [ "serde", ] -[[package]] -name = "toml_datetime" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bade1c3e902f58d73d3f294cd7f20391c1cb2fbcb643b73566bc773971df91e3" -dependencies = [ - "serde", -] - [[package]] name = "toml_datetime" version = "1.1.1+spec-1.1.0" @@ -8779,6 +9506,12 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "unit-prefix" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81e544489bf3d8ef66c953931f56617f423cd4b5494be343d9b9d3dda037b9a3" + [[package]] name = "universal-hash" version = "0.5.1" @@ -8801,6 +9534,39 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" +[[package]] +name = "ureq" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dea7109cdcd5864d4eeb1b58a1648dc9bf520360d7af16ec26d0a9354bafcfc0" +dependencies = [ + "base64 0.22.1", + "cookie_store", + "flate2", + "log 0.4.29", + "percent-encoding", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "socks", + "ureq-proto", + "utf8-zero", + "webpki-roots", +] + +[[package]] +name = "ureq-proto" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e994ba84b0bd1b1b0cf92878b7ef898a5c1760108fe7b6010327e274917a808c" +dependencies = [ + "base64 0.22.1", + "http", + "httparse", + "log 0.4.29", +] + [[package]] name = "url" version = "2.5.4" @@ -8849,6 +9615,12 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3" +[[package]] +name = "utf8-zero" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8c0a043c9540bae7c578c88f91dda8bd82e59ae27c21baca69c8b191aaf5a6e" + [[package]] name = "utf8_iter" version = "1.0.4" @@ -8979,6 +9751,12 @@ dependencies = [ "try-lock", ] +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -9157,6 +9935,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "web_atoms" version = "0.2.4" @@ -9164,9 +9952,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7cff6eef815df1834fd250e3a2ff436044d82a9f1bc1980ca1dbdf07effc538" dependencies = [ "phf 0.13.1", - "phf_codegen", - "string_cache", - "string_cache_codegen", + "phf_codegen 0.13.1", + "string_cache 0.9.0", + "string_cache_codegen 0.6.1", ] [[package]] @@ -9238,6 +10026,15 @@ dependencies = [ "rustls-pki-types", ] +[[package]] +name = "webpki-roots" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf85cb06032201fa7c6f829d7db5a7e5aa45bcc0655327713065f6f0576731bf" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "webview2-com" version = "0.38.0" @@ -9302,7 +10099,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -9875,6 +10672,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "winreg" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "winreg" version = "0.55.0" @@ -10113,6 +10920,7 @@ dependencies = [ "yaak-plugins", "yaak-sse", "yaak-sync", + "yaak-system-appearance", "yaak-tauri-utils", "yaak-templates", "yaak-tls", @@ -10143,7 +10951,7 @@ dependencies = [ "assert_cmd", "base64 0.22.1", "clap", - "console", + "console 0.15.11", "dirs", "env_logger", "futures", @@ -10157,7 +10965,7 @@ dependencies = [ "rand 0.8.5", "reqwest 0.12.20", "rolldown", - "schemars", + "schemars 0.8.22", "serde", "serde_json", "sha2", @@ -10357,7 +11165,7 @@ dependencies = [ "r2d2", "r2d2_sqlite", "rusqlite", - "schemars", + "schemars 0.8.22", "sea-query", "sea-query-rusqlite", "serde", @@ -10471,6 +11279,15 @@ dependencies = [ "yaak-models", ] +[[package]] +name = "yaak-system-appearance" +version = "0.1.0" +dependencies = [ + "dark-light", + "log 0.4.29", + "tauri", +] + [[package]] name = "yaak-tauri-utils" version = "0.1.0" @@ -10597,7 +11414,7 @@ dependencies = [ "async-trait", "blocking", "enumflags2", - "event-listener", + "event-listener 5.4.0", "futures-core", "futures-lite", "hex", @@ -10743,7 +11560,7 @@ checksum = "153a6fff49d264c4babdcfa6b4d534747f520e56e8f0f384f3b808c4b64cc1fd" dependencies = [ "aes", "arbitrary", - "bzip2", + "bzip2 0.5.2", "constant_time_eq 0.3.1", "crc32fast", "deflate64", @@ -10827,6 +11644,7 @@ dependencies = [ "endi", "enumflags2", "serde", + "url", "winnow 0.7.10", "zvariant_derive", "zvariant_utils", diff --git a/Cargo.toml b/Cargo.toml index 41bff103..51b855f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,7 @@ members = [ "crates-tauri/yaak-fonts", "crates-tauri/yaak-license", "crates-tauri/yaak-mac-window", + "crates-tauri/yaak-system-appearance", "crates-tauri/yaak-tauri-utils", "crates-tauri/yaak-window", ] @@ -47,7 +48,11 @@ schemars = { version = "0.8.22", features = ["chrono"] } serde = "1.0.228" serde_json = "1.0.145" sha2 = "0.10.9" -tauri = "2.11.1" +tauri = { version = "2.11.1", default-features = false, features = [ + "common-controls-v6", + "compression", + "dynamic-acl", +] } tauri-plugin = "2.6.1" tauri-plugin-dialog = "2.7.1" tauri-plugin-shell = "2.3.5" @@ -84,8 +89,13 @@ yaak-proxy-lib = { path = "crates-proxy/yaak-proxy-lib" } yaak-fonts = { path = "crates-tauri/yaak-fonts" } yaak-license = { path = "crates-tauri/yaak-license" } yaak-mac-window = { path = "crates-tauri/yaak-mac-window" } +yaak-system-appearance = { path = "crates-tauri/yaak-system-appearance" } yaak-tauri-utils = { path = "crates-tauri/yaak-tauri-utils" } yaak-window = { path = "crates-tauri/yaak-window" } [profile.release] strip = false + +[patch.crates-io] +tauri = { git = "https://github.com/tauri-apps/tauri", rev = "d9bc695c18d9a25baec21d8a5f36d72e3a14ee53" } +tauri-build = { git = "https://github.com/tauri-apps/tauri", rev = "d9bc695c18d9a25baec21d8a5f36d72e3a14ee53" } diff --git a/apps/yaak-client/theme.ts b/apps/yaak-client/theme.ts index c01446b1..3d01a3d4 100644 --- a/apps/yaak-client/theme.ts +++ b/apps/yaak-client/theme.ts @@ -1,32 +1,49 @@ import { listen } from "@tauri-apps/api/event"; import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow"; +import { type as osType } from "@tauri-apps/plugin-os"; import { setWindowTheme } from "@yaakapp-internal/mac-window"; import type { ModelPayload } from "@yaakapp-internal/models"; import type { Appearance } from "@yaakapp-internal/theme"; import { applyThemeToDocument, getCSSAppearance, - subscribeToPreferredAppearance, + subscribeToPreferredAppearanceChange, + subscribeToSystemAppearanceChange, } from "@yaakapp-internal/theme"; import { getSettings } from "./lib/settings"; import { getResolvedTheme } from "./lib/themes"; // NOTE: CSS appearance isn't as accurate as getting it async from the window (next step), but we want // a good appearance guess so we're not waiting too long -let preferredAppearance: Appearance = getCSSAppearance(); -subscribeToPreferredAppearance(async (a) => { +let preferredAppearance: Appearance = getInitialAppearance(); +let linuxSystemAppearanceAvailable = + osType() === "linux" && window.__YAAK_INITIAL_APPEARANCE_SOURCE__ === "linux-system"; +let configureThemeGeneration = 0; +let windowShown = false; + +configureThemeAndShow().catch((err) => console.log("Failed to configure theme", err)); + +subscribeToPreferredAppearanceChange(async (a) => { + if (linuxSystemAppearanceAvailable) return; preferredAppearance = a; - await configureTheme(); + await configureThemeAndShow(); }); -configureTheme().then( - async () => { +subscribeToSystemAppearanceChange(async (a) => { + linuxSystemAppearanceAvailable = true; + preferredAppearance = a; + await configureThemeAndShow(); +}); + +async function configureThemeAndShow() { + const applied = await configureTheme(); + if (applied && !windowShown) { + windowShown = true; // To prevent theme flashing, the backend hides new windows by default, so we // need to show it here, after configuring the theme for the first time. await getCurrentWebviewWindow().show(); - }, - (err) => console.log("Failed to configure theme", err), -); + } +} // Listen for settings changes, the re-compute theme listen("model_write", async (event) => { @@ -34,10 +51,11 @@ listen("model_write", async (event) => { const model = event.payload.model.model; if (model !== "settings" && model !== "plugin") return; - await configureTheme(); + await configureThemeAndShow(); }).catch(console.error); -async function configureTheme() { +async function configureTheme(): Promise { + const generation = ++configureThemeGeneration; const settings = await getSettings(); const theme = await getResolvedTheme( preferredAppearance, @@ -45,8 +63,30 @@ async function configureTheme() { settings.themeLight, settings.themeDark, ); + + if (generation !== configureThemeGeneration) { + return false; + } + applyThemeToDocument(theme.active); if (theme.active.base.surface != null) { setWindowTheme(theme.active.base.surface); } + + return true; +} + +function getInitialAppearance(): Appearance { + const initialAppearance = window.__YAAK_INITIAL_APPEARANCE__; + if (initialAppearance === "dark" || initialAppearance === "light") { + return initialAppearance; + } + return getCSSAppearance(); +} + +declare global { + interface Window { + __YAAK_INITIAL_APPEARANCE__?: Appearance; + __YAAK_INITIAL_APPEARANCE_SOURCE__?: "settings" | "linux-system"; + } } diff --git a/crates-cli/yaak-cli/src/commands/plugin.rs b/crates-cli/yaak-cli/src/commands/plugin.rs index 2eb1038c..c565a5e3 100644 --- a/crates-cli/yaak-cli/src/commands/plugin.rs +++ b/crates-cli/yaak-cli/src/commands/plugin.rs @@ -855,8 +855,6 @@ exports.plugin = { assert_eq!(metadata["apis"]["workspaceActions"]["items"][0]["label"], "Sync workspace"); assert_eq!(metadata["apis"]["lifecycle"]["items"][0]["name"], "init"); assert!(metadata["apis"]["templateFunctions"]["items"][0]["onRender"].is_null()); - assert!( - metadata["apis"]["templateFunctions"]["items"][0]["args"][0]["dynamic"].is_null() - ); + assert!(metadata["apis"]["templateFunctions"]["items"][0]["args"][0]["dynamic"].is_null()); } } diff --git a/crates-cli/yaak-cli/src/plugin_events.rs b/crates-cli/yaak-cli/src/plugin_events.rs index 70bc2adc..f71f5ba9 100644 --- a/crates-cli/yaak-cli/src/plugin_events.rs +++ b/crates-cli/yaak-cli/src/plugin_events.rs @@ -470,11 +470,7 @@ async fn build_plugin_reply( } }; - let names = cookie_jar - .cookies - .into_iter() - .map(|c| c.name) - .collect(); + let names = cookie_jar.cookies.into_iter().map(|c| c.name).collect(); Some(InternalEventPayload::ListCookieNamesResponse(ListCookieNamesResponse { names, diff --git a/crates-tauri/yaak-app-client/Cargo.toml b/crates-tauri/yaak-app-client/Cargo.toml index e048c4bb..9ba4a91b 100644 --- a/crates-tauri/yaak-app-client/Cargo.toml +++ b/crates-tauri/yaak-app-client/Cargo.toml @@ -13,6 +13,8 @@ crate-type = ["staticlib", "cdylib", "lib"] [features] cargo-clippy = [] default = [] +cef = ["tauri/cef"] +wry = ["tauri/wry", "tauri/x11", "tauri/dbus"] updater = [] license = ["yaak-license"] @@ -82,6 +84,7 @@ yaak-mac-window = { workspace = true } yaak-models = { workspace = true } yaak-plugins = { workspace = true } yaak-sse = { workspace = true } +yaak-system-appearance = { workspace = true } yaak-sync = { workspace = true } yaak-templates = { workspace = true } yaak-tls = { workspace = true } diff --git a/crates-tauri/yaak-app-client/src/lib.rs b/crates-tauri/yaak-app-client/src/lib.rs index 50962f9e..87bb07eb 100644 --- a/crates-tauri/yaak-app-client/src/lib.rs +++ b/crates-tauri/yaak-app-client/src/lib.rs @@ -82,6 +82,14 @@ mod uri_scheme; mod window_menu; mod ws_ext; +#[cfg(not(any(feature = "cef", feature = "wry")))] +compile_error!("Enable one Tauri runtime feature: `cef` or `wry`."); + +#[cfg(feature = "cef")] +type TauriRuntime = tauri::Cef; +#[cfg(all(not(feature = "cef"), feature = "wry"))] +type TauriRuntime = tauri::Wry; + fn setup_window_menu(win: &WebviewWindow) -> Result<()> { #[allow(unused_variables)] let menu = window_menu::app_menu(win.app_handle())?; @@ -150,6 +158,22 @@ fn setup_window_menu(win: &WebviewWindow) -> Result<()> { Ok(()) } +fn initial_appearance_script(app_handle: &AppHandle) -> Option { + use yaak_system_appearance::{Appearance, InitialAppearanceSource}; + + let settings = app_handle.db().get_settings(); + let (appearance, source) = match settings.appearance.as_str() { + "dark" => (Appearance::Dark, InitialAppearanceSource::Settings), + "light" => (Appearance::Light, InitialAppearanceSource::Settings), + _ => ( + yaak_system_appearance::system_appearance()?, + InitialAppearanceSource::LinuxSystem, + ), + }; + + Some(yaak_system_appearance::initialization_script(appearance, source)) +} + /// Extension trait for easily creating a PluginContext from a WebviewWindow pub trait PluginContextExt { fn plugin_context(&self) -> PluginContext; @@ -177,7 +201,7 @@ struct AppMetaData { } #[tauri::command] -async fn cmd_metadata(app_handle: AppHandle) -> YaakResult { +async fn cmd_metadata(app_handle: AppHandle) -> YaakResult { let app_data_dir = app_handle.path().app_data_dir()?; let app_log_dir = app_handle.path().app_log_dir()?; let vendored_plugin_dir = @@ -962,7 +986,7 @@ async fn cmd_send_ephemeral_request( mut request: HttpRequest, environment_id: Option<&str>, cookie_jar_id: Option<&str>, - window: WebviewWindow, + window: WebviewWindow, app_handle: AppHandle, ) -> YaakResult { let response = HttpResponse::default(); @@ -1588,20 +1612,22 @@ async fn cmd_get_workspace_meta( } #[tauri::command] -async fn cmd_new_child_window( - parent_window: WebviewWindow, +async fn cmd_new_child_window( + parent_window: WebviewWindow, url: &str, label: &str, title: &str, inner_size: (f64, f64), ) -> YaakResult<()> { let use_native_titlebar = parent_window.app_handle().db().get_settings().use_native_titlebar; + let initialization_script = initial_appearance_script(&parent_window.app_handle()); let win = yaak_window::window::create_child_window( &parent_window, url, label, title, inner_size, + initialization_script, use_native_titlebar, )?; setup_window_menu(&win)?; @@ -1609,9 +1635,15 @@ async fn cmd_new_child_window( } #[tauri::command] -async fn cmd_new_main_window(app_handle: AppHandle, url: &str) -> YaakResult<()> { +async fn cmd_new_main_window(app_handle: AppHandle, url: &str) -> YaakResult<()> { let use_native_titlebar = app_handle.db().get_settings().use_native_titlebar; - let win = yaak_window::window::create_main_window(&app_handle, url, use_native_titlebar)?; + let initialization_script = initial_appearance_script(&app_handle); + let win = yaak_window::window::create_main_window( + &app_handle, + url, + initialization_script, + use_native_titlebar, + )?; setup_window_menu(&win)?; Ok(()) } @@ -1631,8 +1663,9 @@ async fn cmd_check_for_updates( } #[cfg_attr(mobile, tauri::mobile_entry_point)] +#[cfg_attr(feature = "cef", tauri::cef_entry_point)] pub fn run() { - let mut builder = tauri::Builder::default().plugin( + let mut builder = tauri::Builder::::default().plugin( Builder::default() .targets([ Target::new(TargetKind::Stdout), @@ -1706,6 +1739,10 @@ pub fn run() { app.state::().inner().clone(); let app_id = app.config().identifier.to_string(); app.manage(yaak_crypto::manager::EncryptionManager::new(query_manager, app_id)); + #[cfg(target_os = "linux")] + if let Some(state) = yaak_system_appearance::watch(app.app_handle().clone()) { + app.manage(state); + } { let app_handle = app.app_handle().clone(); @@ -1894,9 +1931,11 @@ pub fn run() { match event { RunEvent::Ready => { let use_native_titlebar = app_handle.db().get_settings().use_native_titlebar; + let initialization_script = initial_appearance_script(app_handle); if let Ok(win) = yaak_window::window::create_main_window( app_handle, "/", + initialization_script, use_native_titlebar, ) { let _ = setup_window_menu(&win); @@ -1917,6 +1956,13 @@ pub fn run() { }); } RunEvent::WindowEvent { event: WindowEvent::Focused(true), label, .. } => { + #[cfg(target_os = "linux")] + if let Some(state) = + app_handle.try_state::() + { + yaak_system_appearance::emit_change(app_handle, &state); + } + if cfg!(feature = "updater") { // Run update check whenever the window is focused let w = app_handle.get_webview_window(&label).unwrap(); diff --git a/crates-tauri/yaak-app-client/tauri.conf.json b/crates-tauri/yaak-app-client/tauri.conf.json index 164a7863..70f56791 100644 --- a/crates-tauri/yaak-app-client/tauri.conf.json +++ b/crates-tauri/yaak-app-client/tauri.conf.json @@ -6,7 +6,8 @@ "beforeBuildCommand": "npm --prefix ../.. run client:tauri-before-build", "beforeDevCommand": "npm --prefix ../.. run client:tauri-before-dev", "devUrl": "http://localhost:1420", - "frontendDist": "../../dist/apps/yaak-client" + "frontendDist": "../../dist/apps/yaak-client", + "features": ["wry"] }, "app": { "withGlobalTauri": false, diff --git a/crates-tauri/yaak-app-client/tauri.release.conf.json b/crates-tauri/yaak-app-client/tauri.release.conf.json index bc91f894..0754dca1 100644 --- a/crates-tauri/yaak-app-client/tauri.release.conf.json +++ b/crates-tauri/yaak-app-client/tauri.release.conf.json @@ -1,7 +1,4 @@ { - "build": { - "features": ["updater", "license"] - }, "app": { "security": { "capabilities": [ diff --git a/crates-tauri/yaak-app-proxy/Cargo.toml b/crates-tauri/yaak-app-proxy/Cargo.toml index 74581bbd..a9bdbd56 100644 --- a/crates-tauri/yaak-app-proxy/Cargo.toml +++ b/crates-tauri/yaak-app-proxy/Cargo.toml @@ -12,6 +12,10 @@ crate-type = ["staticlib", "cdylib", "lib"] [build-dependencies] tauri-build = { version = "2.6.1", features = [] } +[features] +default = ["wry"] +wry = ["tauri/wry", "tauri/x11", "tauri/dbus"] + [dependencies] log = { workspace = true } serde_json = { workspace = true } diff --git a/crates-tauri/yaak-system-appearance/Cargo.toml b/crates-tauri/yaak-system-appearance/Cargo.toml new file mode 100644 index 00000000..72928f1f --- /dev/null +++ b/crates-tauri/yaak-system-appearance/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "yaak-system-appearance" +version = "0.1.0" +edition = "2024" +publish = false + +[target.'cfg(target_os = "linux")'.dependencies] +dark-light = "2.0.0" + +[dependencies] +log = { workspace = true } +tauri = { workspace = true } diff --git a/crates-tauri/yaak-system-appearance/src/lib.rs b/crates-tauri/yaak-system-appearance/src/lib.rs new file mode 100644 index 00000000..cd644390 --- /dev/null +++ b/crates-tauri/yaak-system-appearance/src/lib.rs @@ -0,0 +1,151 @@ +use std::sync::{Arc, Mutex}; +use std::time::Duration; + +use log::{debug, warn}; +use tauri::{AppHandle, Emitter, Runtime}; + +pub const INITIAL_APPEARANCE_GLOBAL: &str = "__YAAK_INITIAL_APPEARANCE__"; +pub const INITIAL_APPEARANCE_SOURCE_GLOBAL: &str = "__YAAK_INITIAL_APPEARANCE_SOURCE__"; +pub const SYSTEM_APPEARANCE_CHANGE_EVENT: &str = "system_appearance_change"; + +const SYSTEM_APPEARANCE_POLL_INTERVAL: Duration = Duration::from_secs(1); + +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum Appearance { + Dark, + Light, +} + +impl Appearance { + pub fn as_str(self) -> &'static str { + match self { + Self::Dark => "dark", + Self::Light => "light", + } + } +} + +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum InitialAppearanceSource { + Settings, + LinuxSystem, +} + +impl InitialAppearanceSource { + fn as_str(self) -> &'static str { + match self { + Self::Settings => "settings", + Self::LinuxSystem => "linux-system", + } + } +} + +#[derive(Clone)] +pub struct SystemAppearanceState { + last_appearance: Arc>>, +} + +pub fn initialization_script(appearance: Appearance, source: InitialAppearanceSource) -> String { + let appearance = appearance.as_str(); + let source = source.as_str(); + format!( + "window.{INITIAL_APPEARANCE_GLOBAL} = {appearance:?};\ + window.{INITIAL_APPEARANCE_SOURCE_GLOBAL} = {source:?};" + ) +} + +#[cfg(target_os = "linux")] +pub fn system_appearance() -> Option { + if let Some(appearance) = gsettings_system_appearance() { + return Some(appearance); + } + + match dark_light::detect() { + Ok(dark_light::Mode::Dark) => Some(Appearance::Dark), + Ok(dark_light::Mode::Light) => Some(Appearance::Light), + Ok(dark_light::Mode::Unspecified) => None, + Err(err) => { + debug!("Failed to detect Linux system appearance: {err:?}"); + None + } + } +} + +#[cfg(not(target_os = "linux"))] +pub fn system_appearance() -> Option { + None +} + +#[cfg(target_os = "linux")] +pub fn watch(app_handle: AppHandle) -> Option { + let last_appearance = system_appearance(); + if last_appearance.is_none() { + debug!("Linux system appearance detection unavailable"); + return None; + } + + let state = SystemAppearanceState { last_appearance: Arc::new(Mutex::new(last_appearance)) }; + let thread_state = state.clone(); + let _ = std::thread::spawn(move || { + loop { + std::thread::sleep(SYSTEM_APPEARANCE_POLL_INTERVAL); + emit_change(&app_handle, &thread_state); + } + }); + + Some(state) +} + +#[cfg(not(target_os = "linux"))] +pub fn watch(_app_handle: AppHandle) -> Option { + None +} + +#[cfg(target_os = "linux")] +pub fn emit_change(app_handle: &AppHandle, state: &SystemAppearanceState) { + let appearance = system_appearance(); + let mut last_appearance = + state.last_appearance.lock().expect("system appearance lock poisoned"); + if appearance == *last_appearance { + return; + } + + *last_appearance = appearance; + if let Some(appearance) = appearance { + let appearance = appearance.as_str(); + debug!("System appearance changed to {appearance}"); + if let Err(err) = app_handle.emit(SYSTEM_APPEARANCE_CHANGE_EVENT, appearance) { + warn!("Failed to emit system appearance change: {err:?}"); + } + } +} + +#[cfg(target_os = "linux")] +fn gsettings_system_appearance() -> Option { + let color_scheme = std::process::Command::new("gsettings") + .args(["get", "org.gnome.desktop.interface", "color-scheme"]) + .output() + .ok() + .and_then(|output| String::from_utf8(output.stdout).ok()) + .unwrap_or_default(); + + if color_scheme.contains("prefer-dark") { + return Some(Appearance::Dark); + } + if color_scheme.contains("prefer-light") { + return Some(Appearance::Light); + } + + let gtk_theme = std::process::Command::new("gsettings") + .args(["get", "org.gnome.desktop.interface", "gtk-theme"]) + .output() + .ok() + .and_then(|output| String::from_utf8(output.stdout).ok()) + .unwrap_or_default(); + + if gtk_theme.to_lowercase().contains("dark") { + return Some(Appearance::Dark); + } + + (!gtk_theme.trim().is_empty()).then_some(Appearance::Light) +} diff --git a/crates-tauri/yaak-window/src/window.rs b/crates-tauri/yaak-window/src/window.rs index 08fbd6d4..d61c5b12 100644 --- a/crates-tauri/yaak-window/src/window.rs +++ b/crates-tauri/yaak-window/src/window.rs @@ -26,6 +26,7 @@ pub struct CreateWindowConfig<'s> { pub navigation_tx: Option>, pub close_tx: Option>, pub data_dir_key: Option, + pub initialization_script: Option, pub hidden: bool, pub hide_titlebar: bool, pub use_native_titlebar: bool, @@ -59,6 +60,10 @@ pub fn create_window( .maximized(maximized) .min_inner_size(MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT); + if let Some(script) = config.initialization_script { + win_builder = win_builder.initialization_script(script); + } + if let Some(key) = config.data_dir_key { #[cfg(not(target_os = "macos"))] { @@ -138,11 +143,12 @@ pub fn create_window( Ok(win) } -pub fn create_main_window( - handle: &AppHandle, +pub fn create_main_window( + handle: &AppHandle, url: &str, + initialization_script: Option, use_native_titlebar: bool, -) -> tauri::Result { +) -> tauri::Result> { let mut counter = 0; let label = loop { let label = format!("{MAIN_WINDOW_PREFIX}{counter}"); @@ -165,6 +171,8 @@ pub fn create_main_window( 100.0 + random::() * 20.0, )), restore_position: Some(counter == 0), + initialization_script, + hidden: true, hide_titlebar: true, use_native_titlebar, ..Default::default() @@ -173,14 +181,15 @@ pub fn create_main_window( create_window(handle, config) } -pub fn create_child_window( - parent_window: &WebviewWindow, +pub fn create_child_window( + parent_window: &WebviewWindow, url: &str, label: &str, title: &str, inner_size: (f64, f64), + initialization_script: Option, use_native_titlebar: bool, -) -> tauri::Result { +) -> tauri::Result> { let app_handle = parent_window.app_handle(); let state_key = label.to_string(); let label = format!("{OTHER_WINDOW_PREFIX}_{label}"); @@ -202,6 +211,8 @@ pub fn create_child_window( url, inner_size: Some(inner_size), position: Some(position), + initialization_script, + hidden: true, hide_titlebar: true, use_native_titlebar, ..Default::default() diff --git a/crates/yaak-plugins/src/install.rs b/crates/yaak-plugins/src/install.rs index d8ac243f..c97117ad 100644 --- a/crates/yaak-plugins/src/install.rs +++ b/crates/yaak-plugins/src/install.rs @@ -29,10 +29,7 @@ pub async fn delete_and_uninstall( let db = query_manager.connect(); db.delete_plugin_by_id(plugin_id, &update_source)? }; - if let Err(err) = plugin_manager - .uninstall(plugin_context, plugin.directory.as_str()) - .await - { + if let Err(err) = plugin_manager.uninstall(plugin_context, plugin.directory.as_str()).await { if !matches!(err, PluginNotFoundErr(_)) { return Err(err); } diff --git a/package-lock.json b/package-lock.json index 1e151561..44999e81 100644 --- a/package-lock.json +++ b/package-lock.json @@ -80,7 +80,7 @@ "devDependencies": { "@rolldown/plugin-babel": "^0.2.3", "@tailwindcss/postcss": "^4.3.2", - "@tauri-apps/cli": "^2.11.1", + "@tauri-apps/cli": "npm:@tauri-apps/cli-cef@3.0.0-alpha.6", "@types/babel__core": "^7.20.5", "@vitejs/plugin-react": "^6.0.1", "@yaakapp/cli": "^0.5.1", @@ -4143,6 +4143,72 @@ "node": ">=14.0.0" } }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/core": { + "version": "1.11.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.2.2", + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/runtime": { + "version": "1.11.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/wasi-threads": { + "version": "1.2.2", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": { + "version": "1.1.4", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@tybys/wasm-util": "^0.10.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/core": "^1.7.1", + "@emnapi/runtime": "^1.7.1" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@tybys/wasm-util": { + "version": "0.10.2", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/tslib": { + "version": "2.8.1", + "dev": true, + "inBundle": true, + "license": "0BSD", + "optional": true + }, "node_modules/@tailwindcss/oxide-win32-arm64-msvc": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.3.2.tgz", @@ -4458,9 +4524,10 @@ } }, "node_modules/@tauri-apps/cli": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli/-/cli-2.11.1.tgz", - "integrity": "sha512-rpEbaJ/HzNb6fwsquwoAbq29/Vt4gADhS423A8fdkwL4edJ0wZmoB8ar7O6JPDL834MUKOCm/rrJ7c9oAaEaYQ==", + "name": "@tauri-apps/cli-cef", + "version": "3.0.0-alpha.6", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-cef/-/cli-cef-3.0.0-alpha.6.tgz", + "integrity": "sha512-4Y52FZZuK6rpDDsJgxMp5q85QpQjf7Yo5IvLZs/CUBaIuMkGBDguDRcfkxhMJlu9qM/cLlBRW27OtqNdOW730w==", "dev": true, "license": "Apache-2.0 OR MIT", "bin": { @@ -4474,23 +4541,23 @@ "url": "https://opencollective.com/tauri" }, "optionalDependencies": { - "@tauri-apps/cli-darwin-arm64": "2.11.1", - "@tauri-apps/cli-darwin-x64": "2.11.1", - "@tauri-apps/cli-linux-arm-gnueabihf": "2.11.1", - "@tauri-apps/cli-linux-arm64-gnu": "2.11.1", - "@tauri-apps/cli-linux-arm64-musl": "2.11.1", - "@tauri-apps/cli-linux-riscv64-gnu": "2.11.1", - "@tauri-apps/cli-linux-x64-gnu": "2.11.1", - "@tauri-apps/cli-linux-x64-musl": "2.11.1", - "@tauri-apps/cli-win32-arm64-msvc": "2.11.1", - "@tauri-apps/cli-win32-ia32-msvc": "2.11.1", - "@tauri-apps/cli-win32-x64-msvc": "2.11.1" + "@tauri-apps/cli-cef-darwin-arm64": "3.0.0-alpha.6", + "@tauri-apps/cli-cef-darwin-x64": "3.0.0-alpha.6", + "@tauri-apps/cli-cef-linux-arm-gnueabihf": "3.0.0-alpha.6", + "@tauri-apps/cli-cef-linux-arm64-gnu": "3.0.0-alpha.6", + "@tauri-apps/cli-cef-linux-arm64-musl": "3.0.0-alpha.6", + "@tauri-apps/cli-cef-linux-riscv64-gnu": "3.0.0-alpha.6", + "@tauri-apps/cli-cef-linux-x64-gnu": "3.0.0-alpha.6", + "@tauri-apps/cli-cef-linux-x64-musl": "3.0.0-alpha.6", + "@tauri-apps/cli-cef-win32-arm64-msvc": "3.0.0-alpha.6", + "@tauri-apps/cli-cef-win32-ia32-msvc": "3.0.0-alpha.6", + "@tauri-apps/cli-cef-win32-x64-msvc": "3.0.0-alpha.6" } }, - "node_modules/@tauri-apps/cli-darwin-arm64": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-2.11.1.tgz", - "integrity": "sha512-6eEKMBXsQPCuM1EmvrjT2+aBuxWQuFdKdW8pzNuNQtpq45nEEpBlD5gr8pUeAyOU1DQKlkFaEc/MPBxb/Pfjtg==", + "node_modules/@tauri-apps/cli-cef-darwin-arm64": { + "version": "3.0.0-alpha.6", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-cef-darwin-arm64/-/cli-cef-darwin-arm64-3.0.0-alpha.6.tgz", + "integrity": "sha512-j6XHXCku1q82SXSXlQdzT7MbgOBX/ziOD+Z4c+B5D51zsaP3h6kcefpMzs71n9ZUegdw6AXpZpk+c+knOh2trQ==", "cpu": [ "arm64" ], @@ -4504,10 +4571,10 @@ "node": ">= 10" } }, - "node_modules/@tauri-apps/cli-darwin-x64": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-2.11.1.tgz", - "integrity": "sha512-LQUO7exfRWjWALNhetph5guWpMeHphRpokOLk0OIbTTExaNwJNFu3I4vb+CCM/4G/QGoZe/5XikZOJdNEFP1ig==", + "node_modules/@tauri-apps/cli-cef-darwin-x64": { + "version": "3.0.0-alpha.6", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-cef-darwin-x64/-/cli-cef-darwin-x64-3.0.0-alpha.6.tgz", + "integrity": "sha512-zBNxrXomAXSZPCYspOjvoi8aVAnJtkSOy3cVD+9aYDpf2zZL4R7VQXcY4M76PvqbGUmCOXT9ztzxV2MyWnBoDQ==", "cpu": [ "x64" ], @@ -4521,10 +4588,10 @@ "node": ">= 10" } }, - "node_modules/@tauri-apps/cli-linux-arm-gnueabihf": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-2.11.1.tgz", - "integrity": "sha512-5i/awiBCRRhOUG8yjn0fMHXIWD5Ez8eEk5LtvOxyQrKuJkRaZDvnbIjZbE183blAwkoA4xN3aO/prJiqscl02Q==", + "node_modules/@tauri-apps/cli-cef-linux-arm-gnueabihf": { + "version": "3.0.0-alpha.6", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-cef-linux-arm-gnueabihf/-/cli-cef-linux-arm-gnueabihf-3.0.0-alpha.6.tgz", + "integrity": "sha512-EcNXX9xsAZj0BuRXBwliR35XML6B5aIbgH8blbEGAr3pDaSCBnNyS/dpORgSdCKuysLidBT7K8fer5mMtbSoUQ==", "cpu": [ "arm" ], @@ -4538,10 +4605,10 @@ "node": ">= 10" } }, - "node_modules/@tauri-apps/cli-linux-arm64-gnu": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-2.11.1.tgz", - "integrity": "sha512-9LrwDw3S9Fygtw/Q6WDhOP+3svJRGAsejeE+GKrc0eO1ThMVhwi2LL6hw4dlKw93IfS7VY1G19sWGxJ/NcU4nA==", + "node_modules/@tauri-apps/cli-cef-linux-arm64-gnu": { + "version": "3.0.0-alpha.6", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-cef-linux-arm64-gnu/-/cli-cef-linux-arm64-gnu-3.0.0-alpha.6.tgz", + "integrity": "sha512-/AwSRWuE5UKGumrXdpRnIBDWVjFAMEMkSFbB/vpFx9PogQ/A0R+i6+zuBh7JPV7FKmyRzVJuNxZ8EmZ319Ir8g==", "cpu": [ "arm64" ], @@ -4555,10 +4622,10 @@ "node": ">= 10" } }, - "node_modules/@tauri-apps/cli-linux-arm64-musl": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.11.1.tgz", - "integrity": "sha512-mNA5dbbqPqDUdTIwdUYYuhO2GvIe9UnB2r0VU2njxBOS3Opbx4gKNC5yP0Iu4rYmEmqdlwry9VzGZQ3wq9dyFg==", + "node_modules/@tauri-apps/cli-cef-linux-arm64-musl": { + "version": "3.0.0-alpha.6", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-cef-linux-arm64-musl/-/cli-cef-linux-arm64-musl-3.0.0-alpha.6.tgz", + "integrity": "sha512-OZ5gjROy4/TlaYQ33roxQYcFIFJH+HZMER9gwTkWxfYUC1gTLLhsBeIYUZzWqm1NQiIc07likg081wsHkCRrWw==", "cpu": [ "arm64" ], @@ -4572,10 +4639,10 @@ "node": ">= 10" } }, - "node_modules/@tauri-apps/cli-linux-riscv64-gnu": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-riscv64-gnu/-/cli-linux-riscv64-gnu-2.11.1.tgz", - "integrity": "sha512-fZj3Gwq+6fUs305T5WQiD5iSGJw+j/4w/HGmk4sHDAcy+rp9zU5eaxB7nOyz5/I/nkNAuKPqfp6uIbiUBXkBCw==", + "node_modules/@tauri-apps/cli-cef-linux-riscv64-gnu": { + "version": "3.0.0-alpha.6", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-cef-linux-riscv64-gnu/-/cli-cef-linux-riscv64-gnu-3.0.0-alpha.6.tgz", + "integrity": "sha512-r9TQKmN4KfeXiiusn0cppRxljKsf96vTsC1ehYi4beh+6JlmGR4pK7eb+LuOGJscnjurAA9b153fpeYO/O1PTw==", "cpu": [ "riscv64" ], @@ -4589,10 +4656,10 @@ "node": ">= 10" } }, - "node_modules/@tauri-apps/cli-linux-x64-gnu": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-2.11.1.tgz", - "integrity": "sha512-XFxGxOvHM7jjeD6ozCKdGfhzJ7lERYDGZl1/Kb4fsvchaJsfLJ981TlyTG8Qy/gFq+f5GitH3bfrX9JAkjPEyw==", + "node_modules/@tauri-apps/cli-cef-linux-x64-gnu": { + "version": "3.0.0-alpha.6", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-cef-linux-x64-gnu/-/cli-cef-linux-x64-gnu-3.0.0-alpha.6.tgz", + "integrity": "sha512-9rrMBVlqbNlp8nTJuZIDQ7iKFwGaVMRCNPIsUIZ56DiaCLoP4po+yvR48n+TyRPZYp1sb3q2Nr/5/zI2q/jFAQ==", "cpu": [ "x64" ], @@ -4606,10 +4673,10 @@ "node": ">= 10" } }, - "node_modules/@tauri-apps/cli-linux-x64-musl": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-2.11.1.tgz", - "integrity": "sha512-d5C2/Zm+68v7R9wTuTCjRQEVrWjcdMkJBZ1+rXse+QdMMlTB9+u9PDNDLw9PQflWxYLaYZ7tjxxL9Nb9II6PbA==", + "node_modules/@tauri-apps/cli-cef-linux-x64-musl": { + "version": "3.0.0-alpha.6", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-cef-linux-x64-musl/-/cli-cef-linux-x64-musl-3.0.0-alpha.6.tgz", + "integrity": "sha512-pcFL71xscjEM/03lrH/GiqIr4SwBWlbvaRh8GxDePJqqrQojNn+kTzVvqowaXVbTrNr5rbHbXzY4rC/5/1Tbsw==", "cpu": [ "x64" ], @@ -4623,10 +4690,10 @@ "node": ">= 10" } }, - "node_modules/@tauri-apps/cli-win32-arm64-msvc": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-arm64-msvc/-/cli-win32-arm64-msvc-2.11.1.tgz", - "integrity": "sha512-YdeVWFAR1pTXzUU6NLstPq4G6OLxuDrXCXEBdmBH+5EZIDXUx0D2kJlz3+YjpazkKvAzYpgziTsyRagls0OfRQ==", + "node_modules/@tauri-apps/cli-cef-win32-arm64-msvc": { + "version": "3.0.0-alpha.6", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-cef-win32-arm64-msvc/-/cli-cef-win32-arm64-msvc-3.0.0-alpha.6.tgz", + "integrity": "sha512-IrMgveBs0HNO7C7BaZCUHGtO9jPbop/iU/5XWNqBx7uYHJL565+yIlpzWPoXhT3qbt8h8FQFO6SU3N+zfvLipA==", "cpu": [ "arm64" ], @@ -4640,10 +4707,10 @@ "node": ">= 10" } }, - "node_modules/@tauri-apps/cli-win32-ia32-msvc": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-2.11.1.tgz", - "integrity": "sha512-VBGkuH0eB9K9LLSMv361Gzr5Ou72sCS4+ztpmkWEQ+wd/amhcYOsf3X6qn1RJZDzIhiOYHJEOysZUC3baD01rA==", + "node_modules/@tauri-apps/cli-cef-win32-ia32-msvc": { + "version": "3.0.0-alpha.6", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-cef-win32-ia32-msvc/-/cli-cef-win32-ia32-msvc-3.0.0-alpha.6.tgz", + "integrity": "sha512-qA/VaRdRwdMt9L2oDGNZPur108mUleKRUSCk6X8sVPcnPjzMfN4/aESeOKsW+zHXN/VhZbV3UieEg4IcYeI2RQ==", "cpu": [ "ia32" ], @@ -4657,10 +4724,10 @@ "node": ">= 10" } }, - "node_modules/@tauri-apps/cli-win32-x64-msvc": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-2.11.1.tgz", - "integrity": "sha512-b3ORhIAKgp9ZYY+zBt7b7r0kLU2kjvyGF0+MS2SBym3emsweGPybEqocJcmtMuxyBhkOKHP4CiuEJEDuAlTx6A==", + "node_modules/@tauri-apps/cli-cef-win32-x64-msvc": { + "version": "3.0.0-alpha.6", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-cef-win32-x64-msvc/-/cli-cef-win32-x64-msvc-3.0.0-alpha.6.tgz", + "integrity": "sha512-EzlhstDVyvHy3M5ieSoH3VBlikgqQS99vFEDKFoy16mwIWUrTG1LkoSI0mKbqmO8DWIEzeSV17XiCw2XEcYslQ==", "cpu": [ "x64" ], diff --git a/package.json b/package.json index b6b4e4c3..a8bc468d 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,7 @@ "devDependencies": { "@rolldown/plugin-babel": "^0.2.3", "@tailwindcss/postcss": "^4.3.2", - "@tauri-apps/cli": "^2.11.1", + "@tauri-apps/cli": "npm:@tauri-apps/cli-cef@3.0.0-alpha.6", "@types/babel__core": "^7.20.5", "@vitejs/plugin-react": "^6.0.1", "@yaakapp/cli": "^0.5.1", diff --git a/packages/theme/src/appearance.ts b/packages/theme/src/appearance.ts index 1c1ff5fb..00e8e0f6 100644 --- a/packages/theme/src/appearance.ts +++ b/packages/theme/src/appearance.ts @@ -1,7 +1,10 @@ +import { listen } from "@tauri-apps/api/event"; import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow"; export type Appearance = "light" | "dark"; +const SYSTEM_APPEARANCE_CHANGE_EVENT = "system_appearance_change"; + export function getCSSAppearance(): Appearance { return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; } @@ -11,6 +14,13 @@ export async function getWindowAppearance(): Promise { return appearance ?? getCSSAppearance(); } +export function subscribeToCSSAppearanceChange(cb: (appearance: Appearance) => void): () => void { + const media = window.matchMedia("(prefers-color-scheme: dark)"); + const listener = () => cb(media.matches ? "dark" : "light"); + media.addEventListener("change", listener); + return () => media.removeEventListener("change", listener); +} + export function subscribeToWindowAppearanceChange( cb: (appearance: Appearance) => void, ): () => void { @@ -29,6 +39,22 @@ export function subscribeToWindowAppearanceChange( return () => container.unsubscribe(); } +export function subscribeToSystemAppearanceChange( + cb: (appearance: Appearance) => void, +): () => void { + const container = { + unsubscribe: () => {}, + }; + + void listen(SYSTEM_APPEARANCE_CHANGE_EVENT, (event) => { + cb(event.payload); + }).then((listener) => { + container.unsubscribe = listener; + }); + + return () => container.unsubscribe(); +} + export function resolveAppearance( preferredAppearance: Appearance, appearanceSetting: string, @@ -40,5 +66,16 @@ export function resolveAppearance( export function subscribeToPreferredAppearance(cb: (appearance: Appearance) => void) { cb(getCSSAppearance()); void getWindowAppearance().then(cb); - subscribeToWindowAppearanceChange(cb); + return subscribeToPreferredAppearanceChange(cb); +} + +export function subscribeToPreferredAppearanceChange(cb: (appearance: Appearance) => void) { + const unsubscribeCSS = subscribeToCSSAppearanceChange(cb); + const unsubscribeWindow = subscribeToWindowAppearanceChange(cb); + const unsubscribeSystem = subscribeToSystemAppearanceChange(cb); + return () => { + unsubscribeCSS(); + unsubscribeWindow(); + unsubscribeSystem(); + }; } diff --git a/packages/theme/src/index.ts b/packages/theme/src/index.ts index 4ff15227..a5f331b0 100644 --- a/packages/theme/src/index.ts +++ b/packages/theme/src/index.ts @@ -1,9 +1,12 @@ export type { Appearance } from "./appearance"; export { + subscribeToCSSAppearanceChange, getCSSAppearance, getWindowAppearance, resolveAppearance, subscribeToPreferredAppearance, + subscribeToPreferredAppearanceChange, + subscribeToSystemAppearanceChange, subscribeToWindowAppearanceChange, } from "./appearance"; export { defaultDarkTheme, defaultLightTheme } from "./defaultThemes"; diff --git a/scripts/run-dev.mjs b/scripts/run-dev.mjs index 86a8c69c..b382b936 100644 --- a/scripts/run-dev.mjs +++ b/scripts/run-dev.mjs @@ -70,7 +70,8 @@ const normalizedAdditionalArgs = []; for (let i = 0; i < additionalArgs.length; i++) { const arg = additionalArgs[i]; if (arg === "--") { - continue; + normalizedAdditionalArgs.push(arg, ...additionalArgs.slice(i + 1)); + break; } if (arg === "--config" && i + 1 < additionalArgs.length) { const value = additionalArgs[i + 1];