diff --git a/Cargo.lock b/Cargo.lock index 3427b27c..5042f398 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -70,6 +70,15 @@ dependencies = [ "equator", ] +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anyhow" version = "1.0.100" @@ -91,6 +100,12 @@ version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" +[[package]] +name = "arc-swap" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" + [[package]] name = "arg_enum_proc_macro" version = "0.3.4" @@ -188,6 +203,16 @@ dependencies = [ "zbus", ] +[[package]] +name = "assets" +version = "0.0.1" +dependencies = [ + "anyhow", + "gpui", + "log", + "rust-embed", +] + [[package]] name = "async-broadcast" version = "0.7.2" @@ -554,6 +579,12 @@ dependencies = [ "fs_extra", ] +[[package]] +name = "base62" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1adf9755786e27479693dedd3271691a92b5e242ab139cacb9fb8e7fb5381111" + [[package]] name = "base64" version = "0.22.1" @@ -652,6 +683,9 @@ name = "bitflags" version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +dependencies = [ + "serde_core", +] [[package]] name = "bitstream-io" @@ -956,6 +990,19 @@ dependencies = [ "zeroize", ] +[[package]] +name = "chrono" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-link 0.2.1", +] + [[package]] name = "cipher" version = "0.4.4" @@ -1004,7 +1051,7 @@ dependencies = [ "cocoa-foundation 0.1.2", "core-foundation 0.9.4", "core-graphics 0.23.2", - "foreign-types", + "foreign-types 0.5.0", "libc", "objc", ] @@ -1020,7 +1067,7 @@ dependencies = [ "cocoa-foundation 0.2.0", "core-foundation 0.10.0", "core-graphics 0.24.0", - "foreign-types", + "foreign-types 0.5.0", "libc", "objc", ] @@ -1067,7 +1114,7 @@ dependencies = [ [[package]] name = "collections" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#7c4a85f5f1e31571be35c2d61783be15224bc5a6" +source = "git+https://github.com/zed-industries/zed#37077a8ebb4c1d8f486e61a2a8bcf0b472af1ab2" dependencies = [ "indexmap", "rustc-hash 2.1.1", @@ -1099,6 +1146,24 @@ dependencies = [ "thiserror 2.0.17", ] +[[package]] +name = "common" +version = "0.0.1" +dependencies = [ + "anyhow", + "chrono", + "dirs 5.0.1", + "futures", + "gpui", + "itertools 0.13.0", + "log", + "nostr", + "nostr-sdk", + "reqwest", + "smallvec", + "smol", +] + [[package]] name = "compression-codecs" version = "0.4.34" @@ -1187,7 +1252,7 @@ dependencies = [ "bitflags 1.3.2", "core-foundation 0.9.4", "core-graphics-types 0.1.3", - "foreign-types", + "foreign-types 0.5.0", "libc", ] @@ -1200,7 +1265,7 @@ dependencies = [ "bitflags 2.10.0", "core-foundation 0.10.0", "core-graphics-types 0.2.0", - "foreign-types", + "foreign-types 0.5.0", "libc", ] @@ -1213,7 +1278,7 @@ dependencies = [ "bitflags 2.10.0", "core-foundation 0.9.4", "core-graphics-types 0.1.3", - "foreign-types", + "foreign-types 0.5.0", "libc", ] @@ -1260,7 +1325,7 @@ checksum = "a593227b66cbd4007b2a050dfdd9e1d1318311409c8d600dc82ba1b15ca9c130" dependencies = [ "core-foundation 0.10.0", "core-graphics 0.24.0", - "foreign-types", + "foreign-types 0.5.0", "libc", ] @@ -1438,7 +1503,7 @@ dependencies = [ [[package]] name = "derive_refineable" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#7c4a85f5f1e31571be35c2d61783be15224bc5a6" +source = "git+https://github.com/zed-industries/zed#37077a8ebb4c1d8f486e61a2a8bcf0b472af1ab2" dependencies = [ "proc-macro2", "quote", @@ -1539,6 +1604,15 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" +[[package]] +name = "doxygen-rs" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "415b6ec780d34dcf624666747194393603d0373b7141eef01d12ee58881507d9" +dependencies = [ + "phf", +] + [[package]] name = "dtor" version = "0.0.6" @@ -1613,6 +1687,26 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" +[[package]] +name = "enum-iterator" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4549325971814bda7a44061bf3fe7e487d447cba01e4220a4b454d630d7a016" +dependencies = [ + "enum-iterator-derive", +] + +[[package]] +name = "enum-iterator-derive" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "685adfa4d6f3d765a26bc5dbc936577de9abf756c1feeb3089b01dd395034842" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "enumflags2" version = "0.7.12" @@ -1815,6 +1909,16 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" +[[package]] +name = "flatbuffers" +version = "25.9.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09b6620799e7340ebd9968d2e0708eb82cf1971e9a16821e2091b6d6e475eed5" +dependencies = [ + "bitflags 2.10.0", + "rustc_version", +] + [[package]] name = "flate2" version = "1.1.5" @@ -1843,6 +1947,15 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bf7cc16383c4b8d58b9905a8509f02926ce3058053c056376248d958c9df1e8" +[[package]] +name = "fluent-uri" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17c704e9dbe1ddd863da1e6ff3567795087b1eb201ce80d8fa81162e1516500d" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "flume" version = "0.11.1" @@ -1913,6 +2026,15 @@ dependencies = [ "ttf-parser 0.25.1", ] +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared 0.1.1", +] + [[package]] name = "foreign-types" version = "0.5.0" @@ -1920,7 +2042,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" dependencies = [ "foreign-types-macros", - "foreign-types-shared", + "foreign-types-shared 0.3.1", ] [[package]] @@ -1934,6 +2056,12 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "foreign-types-shared" version = "0.3.1" @@ -1966,6 +2094,15 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" +[[package]] +name = "fsevent-sys" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" +dependencies = [ + "libc", +] + [[package]] name = "futf" version = "0.1.5" @@ -2169,6 +2306,17 @@ dependencies = [ "regex-syntax", ] +[[package]] +name = "globwalk" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" +dependencies = [ + "bitflags 1.3.2", + "ignore", + "walkdir", +] + [[package]] name = "gloo-timers" version = "0.3.0" @@ -2226,7 +2374,7 @@ dependencies = [ [[package]] name = "gpui" version = "0.2.2" -source = "git+https://github.com/zed-industries/zed#7c4a85f5f1e31571be35c2d61783be15224bc5a6" +source = "git+https://github.com/zed-industries/zed#37077a8ebb4c1d8f486e61a2a8bcf0b472af1ab2" dependencies = [ "anyhow", "as-raw-xcb-connection", @@ -2258,7 +2406,7 @@ dependencies = [ "etagere", "filedescriptor", "flume", - "foreign-types", + "foreign-types 0.5.0", "futures", "gpui_macros", "http_client", @@ -2322,10 +2470,70 @@ dependencies = [ "zed-xim", ] +[[package]] +name = "gpui-component" +version = "0.5.0" +source = "git+https://github.com/longbridge/gpui-component#2d753268ef049eb019d06f5cd8f229e30080dde9" +dependencies = [ + "aho-corasick", + "anyhow", + "chrono", + "enum-iterator", + "gpui", + "gpui-component-macros", + "gpui-macros", + "html5ever", + "itertools 0.13.0", + "lsp-types", + "markdown", + "markup5ever_rcdom", + "notify", + "num-traits", + "once_cell", + "paste", + "regex", + "ropey", + "rust-i18n", + "schemars", + "serde", + "serde_json", + "serde_repr", + "smallvec", + "smol", + "tracing", + "tree-sitter", + "tree-sitter-json", + "unicode-segmentation", + "uuid", + "zed-sum-tree", +] + +[[package]] +name = "gpui-component-macros" +version = "0.5.0" +source = "git+https://github.com/longbridge/gpui-component#2d753268ef049eb019d06f5cd8f229e30080dde9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "gpui-macros" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcb02dd63a2859714ac7b6b476937617c3c744157af1b49f7c904023a79039be" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "gpui_macros" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#7c4a85f5f1e31571be35c2d61783be15224bc5a6" +source = "git+https://github.com/zed-industries/zed#37077a8ebb4c1d8f486e61a2a8bcf0b472af1ab2" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -2336,7 +2544,7 @@ dependencies = [ [[package]] name = "gpui_tokio" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#7c4a85f5f1e31571be35c2d61783be15224bc5a6" +source = "git+https://github.com/zed-industries/zed#37077a8ebb4c1d8f486e61a2a8bcf0b472af1ab2" dependencies = [ "anyhow", "gpui", @@ -2414,6 +2622,40 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "heed" +version = "0.20.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d4f449bab7320c56003d37732a917e18798e2f1709d80263face2b4f9436ddb" +dependencies = [ + "bitflags 2.10.0", + "byteorder", + "heed-traits", + "heed-types", + "libc", + "lmdb-master-sys", + "once_cell", + "page_size", + "synchronoise", + "url", +] + +[[package]] +name = "heed-traits" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb3130048d404c57ce5a1ac61a903696e8fcde7e8c2991e9fcfc1f27c3ef74ff" + +[[package]] +name = "heed-types" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d3f528b053a6d700b2734eabcd0fd49cb8230647aa72958467527b0b7917114" +dependencies = [ + "byteorder", + "heed-traits", +] + [[package]] name = "hermit-abi" version = "0.5.2" @@ -2479,6 +2721,20 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "html5ever" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13771afe0e6e846f1e67d038d4cb29998a6779f93c809212e4e9c32efd244d4" +dependencies = [ + "log", + "mac", + "markup5ever", + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "http" version = "1.4.0" @@ -2515,7 +2771,7 @@ dependencies = [ [[package]] name = "http_client" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#7c4a85f5f1e31571be35c2d61783be15224bc5a6" +source = "git+https://github.com/zed-industries/zed#37077a8ebb4c1d8f486e61a2a8bcf0b472af1ab2" dependencies = [ "anyhow", "async-compression", @@ -2540,7 +2796,7 @@ dependencies = [ [[package]] name = "http_client_tls" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#7c4a85f5f1e31571be35c2d61783be15224bc5a6" +source = "git+https://github.com/zed-industries/zed#37077a8ebb4c1d8f486e61a2a8bcf0b472af1ab2" dependencies = [ "rustls", "rustls-platform-verifier", @@ -2591,12 +2847,29 @@ dependencies = [ "tower-service", ] +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + [[package]] name = "hyper-util" version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f" dependencies = [ + "base64", "bytes", "futures-channel", "futures-core", @@ -2604,12 +2877,40 @@ dependencies = [ "http", "http-body", "hyper", + "ipnet", "libc", + "percent-encoding", "pin-project-lite", "socket2", + "system-configuration", "tokio", "tower-service", "tracing", + "windows-registry 0.5.3", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core 0.61.2", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", ] [[package]] @@ -2714,6 +3015,22 @@ dependencies = [ "icu_properties", ] +[[package]] +name = "ignore" +version = "0.4.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3d782a365a015e0f5c04902246139249abf769125006fbe7649e2ee88169b4a" +dependencies = [ + "crossbeam-deque", + "globset", + "log", + "memchr", + "regex-automata", + "same-file", + "walkdir", + "winapi-util", +] + [[package]] name = "image" version = "0.25.9" @@ -2772,6 +3089,26 @@ dependencies = [ "serde_core", ] +[[package]] +name = "inotify" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdd168d97690d0b8c412d6b6c10360277f4d7ee495c5d0d5d5fe0854923255cc" +dependencies = [ + "bitflags 1.3.2", + "inotify-sys", + "libc", +] + +[[package]] +name = "inotify-sys" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" +dependencies = [ + "libc", +] + [[package]] name = "inout" version = "0.1.4" @@ -2832,6 +3169,16 @@ version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" +[[package]] +name = "iri-string" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f867b9d1d896b67beb18518eda36fdb77a32ea590de864f1325b294a6d14397" +dependencies = [ + "memchr", + "serde", +] + [[package]] name = "is-docker" version = "0.2.0" @@ -2851,6 +3198,15 @@ dependencies = [ "once_cell", ] +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.13.0" @@ -2927,6 +3283,26 @@ dependencies = [ "libloading", ] +[[package]] +name = "kqueue" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac30106d7dce88daf4a3fcb4879ea939476d5074a9b7ddd0fb97fa4bed5596a" +dependencies = [ + "kqueue-sys", + "libc", +] + +[[package]] +name = "kqueue-sys" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b" +dependencies = [ + "bitflags 1.3.2", + "libc", +] + [[package]] name = "kurbo" version = "0.11.3" @@ -3038,6 +3414,17 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" +[[package]] +name = "lmdb-master-sys" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "864808e0b19fb6dd3b70ba94ee671b82fce17554cf80aeb0a155c65bb08027df" +dependencies = [ + "cc", + "doxygen-rs", + "libc", +] + [[package]] name = "lock_api" version = "0.4.14" @@ -3078,14 +3465,30 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" +[[package]] +name = "lsp-types" +version = "0.97.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53353550a17c04ac46c585feb189c2db82154fc84b79c7a66c96c2c644f66071" +dependencies = [ + "bitflags 1.3.2", + "fluent-uri", + "serde", + "serde_json", + "serde_repr", +] + [[package]] name = "lume" version = "0.0.1" dependencies = [ "anyhow", + "assets", + "common", "dirs 5.0.1", "futures", "gpui", + "gpui-component", "gpui_tokio", "itertools 0.13.0", "log", @@ -3097,6 +3500,7 @@ dependencies = [ "serde_json", "smallvec", "smol", + "state", "tracing-subscriber", ] @@ -3176,6 +3580,41 @@ dependencies = [ "libc", ] +[[package]] +name = "markdown" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5cab8f2cadc416a82d2e783a1946388b31654d391d1c7d92cc1f03e295b1deb" +dependencies = [ + "unicode-id", +] + +[[package]] +name = "markup5ever" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16ce3abbeba692c8b8441d036ef91aea6df8da2c6b6e21c7e14d3c18e526be45" +dependencies = [ + "log", + "phf", + "phf_codegen", + "string_cache", + "string_cache_codegen", + "tendril", +] + +[[package]] +name = "markup5ever_rcdom" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edaa21ab3701bfee5099ade5f7e1f84553fd19228cf332f13cd6e964bf59be18" +dependencies = [ + "html5ever", + "markup5ever", + "tendril", + "xml5ever", +] + [[package]] name = "maybe-rayon" version = "0.1.1" @@ -3199,14 +3638,14 @@ dependencies = [ [[package]] name = "media" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#7c4a85f5f1e31571be35c2d61783be15224bc5a6" +source = "git+https://github.com/zed-industries/zed#37077a8ebb4c1d8f486e61a2a8bcf0b472af1ab2" dependencies = [ "anyhow", "bindgen", "core-foundation 0.10.0", "core-video", "ctor", - "foreign-types", + "foreign-types 0.5.0", "metal", "objc", ] @@ -3244,7 +3683,7 @@ dependencies = [ "bitflags 2.10.0", "block", "core-graphics-types 0.1.3", - "foreign-types", + "foreign-types 0.5.0", "log", "objc", "paste", @@ -3295,6 +3734,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" dependencies = [ "libc", + "log", "wasi", "windows-sys 0.61.2", ] @@ -3343,6 +3783,23 @@ dependencies = [ "getrandom 0.2.16", ] +[[package]] +name = "native-tls" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework 2.11.1", + "security-framework-sys", + "tempfile", +] + [[package]] name = "negentropy" version = "0.5.0" @@ -3405,6 +3862,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" +[[package]] +name = "normpath" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf23ab2b905654b4cb177e30b629937b3868311d4e1cba859f899c041046e69b" +dependencies = [ + "windows-sys 0.61.2", +] + [[package]] name = "nostr" version = "0.44.1" @@ -3447,6 +3913,7 @@ version = "0.44.0" source = "git+https://github.com/rust-nostr/nostr#8ef9fb157cc4c895c80bfba8fc9c5f0879aba36c" dependencies = [ "btreecap", + "flatbuffers", "lru", "nostr", "tokio", @@ -3460,6 +3927,20 @@ dependencies = [ "nostr", ] +[[package]] +name = "nostr-lmdb" +version = "0.44.0" +source = "git+https://github.com/rust-nostr/nostr#8ef9fb157cc4c895c80bfba8fc9c5f0879aba36c" +dependencies = [ + "async-utility", + "flume", + "heed", + "nostr", + "nostr-database", + "tokio", + "tracing", +] + [[package]] name = "nostr-relay-pool" version = "0.44.0" @@ -3491,6 +3972,34 @@ dependencies = [ "tracing", ] +[[package]] +name = "notify" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c533b4c39709f9ba5005d8002048266593c1cfaf3c5f0739d5b8ab0c6c504009" +dependencies = [ + "bitflags 2.10.0", + "filetime", + "fsevent-sys", + "inotify", + "kqueue", + "libc", + "log", + "mio", + "notify-types", + "walkdir", + "windows-sys 0.52.0", +] + +[[package]] +name = "notify-types" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585d3cb5e12e01aed9e8a1f70d5c6b5e86fe2a6e48fc8cd0b3e0b8df6f6eb174" +dependencies = [ + "instant", +] + [[package]] name = "ntapi" version = "0.4.1" @@ -3821,12 +4330,50 @@ dependencies = [ "pathdiff", ] +[[package]] +name = "openssl" +version = "0.10.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" +dependencies = [ + "bitflags 2.10.0", + "cfg-if", + "foreign-types 0.3.2", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "openssl-probe" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" +[[package]] +name = "openssl-sys" +version = "0.9.111" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "option-ext" version = "0.2.0" @@ -3843,6 +4390,16 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "page_size" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d5b2194ed13191c1999ae0704b7839fb18384fa22e49b57eeaa97d79ce40da" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "parking" version = "2.2.1" @@ -3939,13 +4496,65 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "perf" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#7c4a85f5f1e31571be35c2d61783be15224bc5a6" +source = "git+https://github.com/zed-industries/zed#37077a8ebb4c1d8f486e61a2a8bcf0b472af1ab2" dependencies = [ "collections", "serde", "serde_json", ] +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_macros", + "phf_shared", +] + +[[package]] +name = "phf_codegen" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" +dependencies = [ + "phf_generator", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared", + "rand 0.8.5", +] + +[[package]] +name = "phf_macros" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + [[package]] name = "pico-args" version = "0.5.0" @@ -4093,6 +4702,12 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + [[package]] name = "prettyplease" version = "0.2.37" @@ -4499,7 +5114,7 @@ dependencies = [ [[package]] name = "refineable" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#7c4a85f5f1e31571be35c2d61783be15224bc5a6" +source = "git+https://github.com/zed-industries/zed#37077a8ebb4c1d8f486e61a2a8bcf0b472af1ab2" dependencies = [ "derive_refineable", ] @@ -4533,10 +5148,54 @@ version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" +[[package]] +name = "reqwest" +version = "0.12.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6eff9328d40131d43bd911d42d79eb6a47312002a4daefc9e37f17e74a7701a" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-tls", + "hyper-util", + "js-sys", + "log", + "mime", + "mime_guess", + "native-tls", + "percent-encoding", + "pin-project-lite", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-native-tls", + "tokio-util", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", +] + [[package]] name = "reqwest_client" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#7c4a85f5f1e31571be35c2d61783be15224bc5a6" +source = "git+https://github.com/zed-industries/zed#37077a8ebb4c1d8f486e61a2a8bcf0b472af1ab2" dependencies = [ "anyhow", "bytes", @@ -4587,6 +5246,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "ropey" +version = "2.0.0-beta.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4045a00dc327d084a2bbf126976e14125b54f23bd30511d45b842eba76c52d74" +dependencies = [ + "str_indices", +] + [[package]] name = "roxmltree" version = "0.20.0" @@ -4628,6 +5296,60 @@ dependencies = [ "walkdir", ] +[[package]] +name = "rust-i18n" +version = "3.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fda2551fdfaf6cc5ee283adc15e157047b92ae6535cf80f6d4962d05717dc332" +dependencies = [ + "globwalk", + "once_cell", + "regex", + "rust-i18n-macro", + "rust-i18n-support", + "smallvec", +] + +[[package]] +name = "rust-i18n-macro" +version = "3.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22baf7d7f56656d23ebe24f6bb57a5d40d2bce2a5f1c503e692b5b2fa450f965" +dependencies = [ + "glob", + "once_cell", + "proc-macro2", + "quote", + "rust-i18n-support", + "serde", + "serde_json", + "serde_yaml", + "syn 2.0.111", +] + +[[package]] +name = "rust-i18n-support" +version = "3.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940ed4f52bba4c0152056d771e563b7133ad9607d4384af016a134b58d758f19" +dependencies = [ + "arc-swap", + "base62", + "globwalk", + "itertools 0.11.0", + "lazy_static", + "normpath", + "once_cell", + "proc-macro2", + "regex", + "serde", + "serde_json", + "serde_yaml", + "siphasher", + "toml 0.8.23", + "triomphe", +] + [[package]] name = "rustc-hash" version = "1.1.0" @@ -4700,7 +5422,7 @@ dependencies = [ "openssl-probe", "rustls-pki-types", "schannel", - "security-framework", + "security-framework 3.5.1", ] [[package]] @@ -4737,7 +5459,7 @@ dependencies = [ "rustls-native-certs", "rustls-platform-verifier-android", "rustls-webpki", - "security-framework", + "security-framework 3.5.1", "security-framework-sys", "webpki-root-certs 0.26.11", "windows-sys 0.59.0", @@ -4934,6 +5656,19 @@ dependencies = [ "cc", ] +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags 2.10.0", + "core-foundation 0.9.4", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + [[package]] name = "security-framework" version = "3.5.1" @@ -5091,6 +5826,19 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_yaml" +version = "0.9.34+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + [[package]] name = "sha1" version = "0.10.6" @@ -5304,12 +6052,41 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "state" +version = "0.0.1" +dependencies = [ + "anyhow", + "common", + "gpui", + "log", + "nostr-lmdb", + "nostr-sdk", + "rustls", + "serde", + "serde_json", + "smallvec", + "smol", +] + [[package]] name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "str_indices" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d08889ec5408683408db66ad89e0e1f93dff55c73a4ccc71c427d5b277ee47e6" + +[[package]] +name = "streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2231b7c3057d5e4ad0156fb3dc807d900806020c5ffa3ee6ff2c8c76fb8520" + [[package]] name = "strict-num" version = "0.1.1" @@ -5319,6 +6096,31 @@ dependencies = [ "float-cmp", ] +[[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", + "precomputed-hash", + "serde", +] + +[[package]] +name = "string_cache_codegen" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c711928715f1fe0fe509c53b43e993a9a557babc2d0a3567d0a3006f1ac931a0" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", +] + [[package]] name = "strum" version = "0.26.3" @@ -5371,7 +6173,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sum_tree" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#7c4a85f5f1e31571be35c2d61783be15224bc5a6" +source = "git+https://github.com/zed-industries/zed#37077a8ebb4c1d8f486e61a2a8bcf0b472af1ab2" dependencies = [ "arrayvec", "log", @@ -5516,6 +6318,15 @@ dependencies = [ "futures-core", ] +[[package]] +name = "synchronoise" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dbc01390fc626ce8d1cffe3376ded2b72a11bb70e1c75f404a210e4daa4def2" +dependencies = [ + "crossbeam-queue", +] + [[package]] name = "synstructure" version = "0.13.2" @@ -5783,6 +6594,16 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + [[package]] name = "tokio-rustls" version = "0.26.4" @@ -5941,6 +6762,24 @@ dependencies = [ "tower-service", ] +[[package]] +name = "tower-http" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" +dependencies = [ + "bitflags 2.10.0", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + [[package]] name = "tower-layer" version = "0.3.3" @@ -6011,6 +6850,47 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "tree-sitter" +version = "0.25.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78f873475d258561b06f1c595d93308a7ed124d9977cb26b148c2084a4a3cc87" +dependencies = [ + "cc", + "regex", + "regex-syntax", + "serde_json", + "streaming-iterator", + "tree-sitter-language", +] + +[[package]] +name = "tree-sitter-json" +version = "0.24.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d727acca406c0020cffc6cf35516764f36c8e3dc4408e5ebe2cb35a947ec471" +dependencies = [ + "cc", + "tree-sitter-language", +] + +[[package]] +name = "tree-sitter-language" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae62f7eae5eb549c71b76658648b72cc6111f2d87d24a1e31fa907f4943e3ce" + +[[package]] +name = "triomphe" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd69c5aa8f924c7519d6372789a74eac5b94fb0f8fcf0d4a97eb0bfc3e785f39" +dependencies = [ + "arc-swap", + "serde", + "stable_deref_trait", +] + [[package]] name = "try-lock" version = "0.2.5" @@ -6116,6 +6996,12 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce61d488bcdc9bc8b5d1772c404828b17fc481c0a582b5581e95fb233aef503e" +[[package]] +name = "unicode-id" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ba288e709927c043cbe476718d37be306be53fb1fafecd0dbe36d072be2580" + [[package]] name = "unicode-ident" version = "1.0.22" @@ -6177,6 +7063,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + [[package]] name = "untrusted" version = "0.9.0" @@ -6237,7 +7129,7 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "util" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#7c4a85f5f1e31571be35c2d61783be15224bc5a6" +source = "git+https://github.com/zed-industries/zed#37077a8ebb4c1d8f486e61a2a8bcf0b472af1ab2" dependencies = [ "anyhow", "async-fs", @@ -6273,7 +7165,7 @@ dependencies = [ [[package]] name = "util_macros" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#7c4a85f5f1e31571be35c2d61783be15224bc5a6" +source = "git+https://github.com/zed-industries/zed#37077a8ebb4c1d8f486e61a2a8bcf0b472af1ab2" dependencies = [ "perf", "quote", @@ -6346,6 +7238,12 @@ dependencies = [ "sval_serde", ] +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.5" @@ -7249,6 +8147,12 @@ version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +[[package]] +name = "workspace-hack" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "beffa227304dbaea3ad6a06ac674f9bc83a3dec3b7f63eeb442de37e7cb6bb01" + [[package]] name = "writeable" version = "0.6.2" @@ -7356,6 +8260,17 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" +[[package]] +name = "xml5ever" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bbb26405d8e919bc1547a5aa9abc95cbfa438f04844f5fdd9dc7596b748bf69" +dependencies = [ + "log", + "mac", + "markup5ever", +] + [[package]] name = "xmlwriter" version = "0.1.0" @@ -7563,6 +8478,18 @@ dependencies = [ "xcb", ] +[[package]] +name = "zed-sum-tree" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d490156d0d7311855564d6e1d6dccab992405a0c0e15e1c8ef18920c02177e35" +dependencies = [ + "arrayvec", + "log", + "rayon", + "workspace-hack", +] + [[package]] name = "zed-xim" version = "0.4.0-zed" @@ -7679,7 +8606,7 @@ dependencies = [ [[package]] name = "ztracing" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#7c4a85f5f1e31571be35c2d61783be15224bc5a6" +source = "git+https://github.com/zed-industries/zed#37077a8ebb4c1d8f486e61a2a8bcf0b472af1ab2" dependencies = [ "tracing", "tracing-subscriber", @@ -7689,7 +8616,7 @@ dependencies = [ [[package]] name = "ztracing_macro" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#7c4a85f5f1e31571be35c2d61783be15224bc5a6" +source = "git+https://github.com/zed-industries/zed#37077a8ebb4c1d8f486e61a2a8bcf0b472af1ab2" [[package]] name = "zune-core" diff --git a/Cargo.toml b/Cargo.toml index 574a3db0..4dd3456d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ publish = false [workspace.dependencies] # GPUI gpui = { git = "https://github.com/zed-industries/zed" } +gpui-component = { git = "https://github.com/longbridge/gpui-component" } gpui_tokio = { git = "https://github.com/zed-industries/zed" } reqwest_client = { git = "https://github.com/zed-industries/zed" } diff --git a/crates/assets/Cargo.toml b/crates/assets/Cargo.toml new file mode 100644 index 00000000..3e3d11fd --- /dev/null +++ b/crates/assets/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "assets" +version.workspace = true +edition.workspace = true +publish.workspace = true + +[dependencies] +gpui.workspace = true +anyhow.workspace = true +log.workspace = true +rust-embed.workspace = true diff --git a/crates/assets/src/lib.rs b/crates/assets/src/lib.rs new file mode 100644 index 00000000..65b7b752 --- /dev/null +++ b/crates/assets/src/lib.rs @@ -0,0 +1,59 @@ +use anyhow::Context; +use gpui::{App, AssetSource, Result, SharedString}; +use rust_embed::RustEmbed; + +#[derive(RustEmbed)] +#[folder = "../../assets"] +#[include = "fonts/**/*"] +#[include = "brand/**/*"] +#[include = "icons/**/*"] +#[exclude = "*.DS_Store"] +pub struct Assets; + +impl AssetSource for Assets { + fn load(&self, path: &str) -> Result>> { + Self::get(path) + .map(|f| Some(f.data)) + .with_context(|| format!("loading asset at path {path:?}")) + } + + fn list(&self, path: &str) -> Result> { + Ok(Self::iter() + .filter_map(|p| { + if p.starts_with(path) { + Some(p.into()) + } else { + None + } + }) + .collect()) + } +} + +impl Assets { + /// Populate the [`TextSystem`] of the given [`AppContext`] with all `.ttf` fonts in the `fonts` directory. + pub fn load_fonts(&self, cx: &App) -> anyhow::Result<()> { + let font_paths = self.list("fonts")?; + let mut embedded_fonts = Vec::new(); + for font_path in font_paths { + if font_path.ends_with(".ttf") { + let font_bytes = cx + .asset_source() + .load(&font_path)? + .expect("Assets should never return None"); + embedded_fonts.push(font_bytes); + } + } + + cx.text_system().add_fonts(embedded_fonts) + } + + pub fn load_test_fonts(&self, cx: &App) { + cx.text_system() + .add_fonts(vec![self + .load("fonts/plex-mono/ZedPlexMono-Regular.ttf") + .unwrap() + .unwrap()]) + .unwrap() + } +} diff --git a/crates/common/Cargo.toml b/crates/common/Cargo.toml new file mode 100644 index 00000000..16f51d91 --- /dev/null +++ b/crates/common/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "common" +version.workspace = true +edition.workspace = true +publish.workspace = true + +[dependencies] +gpui.workspace = true +nostr-sdk.workspace = true + +anyhow.workspace = true +itertools.workspace = true +chrono.workspace = true +smallvec.workspace = true +smol.workspace = true +futures.workspace = true +reqwest.workspace = true +log.workspace = true + +dirs = "5.0" +nostr = { git = "https://github.com/rust-nostr/nostr" } diff --git a/crates/common/src/constants.rs b/crates/common/src/constants.rs new file mode 100644 index 00000000..0755b6db --- /dev/null +++ b/crates/common/src/constants.rs @@ -0,0 +1,21 @@ +pub const CLIENT_NAME: &str = "Lume"; +pub const APP_ID: &str = "su.reya.lume"; + +/// Bootstrap Relays. +pub const BOOTSTRAP_RELAYS: [&str; 5] = [ + "wss://relay.damus.io", + "wss://relay.primal.net", + "wss://relay.nos.social", + "wss://user.kindpag.es", + "wss://purplepag.es", +]; + +/// Search Relays. +pub const SEARCH_RELAYS: [&str; 3] = [ + "wss://relay.nostr.band", + "wss://search.nos.today", + "wss://relay.noswhere.com", +]; + +/// Default relay for Nostr Connect +pub const NOSTR_CONNECT_RELAY: &str = "wss://relay.nsec.app"; diff --git a/crates/common/src/lib.rs b/crates/common/src/lib.rs new file mode 100644 index 00000000..56b5b4af --- /dev/null +++ b/crates/common/src/lib.rs @@ -0,0 +1,5 @@ +pub use constants::*; +pub use paths::*; + +mod constants; +mod paths; diff --git a/crates/common/src/paths.rs b/crates/common/src/paths.rs new file mode 100644 index 00000000..2edc6807 --- /dev/null +++ b/crates/common/src/paths.rs @@ -0,0 +1,64 @@ +use std::path::PathBuf; +use std::sync::OnceLock; + +/// Returns the path to the user's home directory. +pub fn home_dir() -> &'static PathBuf { + static HOME_DIR: OnceLock = OnceLock::new(); + HOME_DIR.get_or_init(|| dirs::home_dir().expect("failed to determine home directory")) +} + +/// Returns the path to the configuration directory used by Lume. +pub fn config_dir() -> &'static PathBuf { + static CONFIG_DIR: OnceLock = OnceLock::new(); + CONFIG_DIR.get_or_init(|| { + if cfg!(target_os = "windows") { + return dirs::config_dir() + .expect("failed to determine RoamingAppData directory") + .join("Lume"); + } + + if cfg!(any(target_os = "linux", target_os = "freebsd")) { + return if let Ok(flatpak_xdg_config) = std::env::var("FLATPAK_XDG_CONFIG_HOME") { + flatpak_xdg_config.into() + } else { + dirs::config_dir().expect("failed to determine XDG_CONFIG_HOME directory") + } + .join("lume"); + } + + home_dir().join(".config").join("lume") + }) +} + +/// Returns the path to the support directory used by Lume. +pub fn support_dir() -> &'static PathBuf { + static SUPPORT_DIR: OnceLock = OnceLock::new(); + SUPPORT_DIR.get_or_init(|| { + if cfg!(target_os = "macos") { + return home_dir().join("Library/Application Support/Lume"); + } + + if cfg!(any(target_os = "linux", target_os = "freebsd")) { + return if let Ok(flatpak_xdg_data) = std::env::var("FLATPAK_XDG_DATA_HOME") { + flatpak_xdg_data.into() + } else { + dirs::data_local_dir().expect("failed to determine XDG_DATA_HOME directory") + } + .join("lume"); + } + + if cfg!(target_os = "windows") { + return dirs::data_local_dir() + .expect("failed to determine LocalAppData directory") + .join("lume"); + } + + config_dir().clone() + }) +} + +/// Returns the path to the `nostr` file. +pub fn nostr_file() -> &'static PathBuf { + static NOSTR_FILE: OnceLock = OnceLock::new(); + NOSTR_FILE.get_or_init(|| support_dir().join("nostr-db")) +} diff --git a/crates/lume/Cargo.toml b/crates/lume/Cargo.toml index 8dafd218..9b3d5db1 100644 --- a/crates/lume/Cargo.toml +++ b/crates/lume/Cargo.toml @@ -9,7 +9,12 @@ name = "lume" path = "src/main.rs" [dependencies] +common = { path = "../common" } +assets = { path = "../assets" } +state = { path = "../state" } + gpui.workspace = true +gpui-component.workspace = true gpui_tokio.workspace = true reqwest_client.workspace = true diff --git a/crates/lume/src/actions.rs b/crates/lume/src/actions.rs new file mode 100644 index 00000000..ef5fca8e --- /dev/null +++ b/crates/lume/src/actions.rs @@ -0,0 +1,34 @@ +use std::sync::Mutex; + +use gpui::{actions, App}; + +actions!(coop, [Quit]); + +pub fn load_embedded_fonts(cx: &App) { + let asset_source = cx.asset_source(); + let font_paths = asset_source.list("fonts").unwrap(); + let embedded_fonts = Mutex::new(Vec::new()); + let executor = cx.background_executor(); + + executor.block(executor.scoped(|scope| { + for font_path in &font_paths { + if !font_path.ends_with(".ttf") { + continue; + } + + scope.spawn(async { + let font_bytes = asset_source.load(font_path).unwrap().unwrap(); + embedded_fonts.lock().unwrap().push(font_bytes); + }); + } + })); + + cx.text_system() + .add_fonts(embedded_fonts.into_inner().unwrap()) + .unwrap(); +} + +pub fn quit(_: &Quit, cx: &mut App) { + log::info!("Gracefully quitting the application . . ."); + cx.quit(); +} diff --git a/crates/lume/src/main.rs b/crates/lume/src/main.rs index e7a11a96..19799a81 100644 --- a/crates/lume/src/main.rs +++ b/crates/lume/src/main.rs @@ -1,3 +1,102 @@ +use std::sync::Arc; + +use assets::Assets; +use common::{APP_ID, CLIENT_NAME}; +use gpui::{ + div, point, px, size, AppContext, Application, Bounds, Context, IntoElement, KeyBinding, Menu, + MenuItem, ParentElement, Render, SharedString, Styled, TitlebarOptions, Window, + WindowBackgroundAppearance, WindowBounds, WindowDecorations, WindowKind, WindowOptions, +}; +use gpui_component::button::{Button, ButtonVariants}; +use gpui_component::{Root, StyledExt}; + +use crate::actions::{load_embedded_fonts, quit, Quit}; + +mod actions; + fn main() { - println!("Hello, world!"); + // Initialize logging + tracing_subscriber::fmt::init(); + + // Initialize the Application + let app = Application::new() + .with_assets(Assets) + .with_http_client(Arc::new(reqwest_client::ReqwestClient::new())); + + // Run application + app.run(move |cx| { + // Load embedded fonts in assets/fonts + load_embedded_fonts(cx); + + // Register the `quit` function + cx.on_action(quit); + + // Register the `quit` function with CMD+Q (macOS) + #[cfg(target_os = "macos")] + cx.bind_keys([KeyBinding::new("cmd-q", Quit, None)]); + + // Register the `quit` function with Super+Q (others) + #[cfg(not(target_os = "macos"))] + cx.bind_keys([KeyBinding::new("super-q", Quit, None)]); + + // Set menu items + cx.set_menus(vec![Menu { + name: "Lume".into(), + items: vec![MenuItem::action("Quit", Quit)], + }]); + + // Set up the window bounds + let bounds = Bounds::centered(None, size(px(920.0), px(700.0)), cx); + + // Set up the window options + let opts = WindowOptions { + window_background: WindowBackgroundAppearance::Opaque, + window_decorations: Some(WindowDecorations::Client), + window_bounds: Some(WindowBounds::Windowed(bounds)), + kind: WindowKind::Normal, + app_id: Some(APP_ID.to_owned()), + titlebar: Some(TitlebarOptions { + title: Some(SharedString::new_static(CLIENT_NAME)), + traffic_light_position: Some(point(px(9.0), px(9.0))), + appears_transparent: true, + }), + ..Default::default() + }; + + // Open a window with default options + cx.open_window(opts, |window, cx| { + // Bring the app to the foreground + cx.activate(true); + + // Initialize the tokio runtime + gpui_tokio::init(cx); + + // Initialize components + gpui_component::init(cx); + + let view = cx.new(|_| HelloWorld); + cx.new(|cx| Root::new(view, window, cx)) + }) + .expect("Failed to open window. Please restart the application."); + }) +} + +pub struct HelloWorld; + +impl Render for HelloWorld { + fn render(&mut self, _: &mut Window, _: &mut Context) -> impl IntoElement { + div() + .v_flex() + .gap_2() + .size_full() + .items_center() + .justify_center() + .child("Hello, World!") + .child( + Button::new("ok") + .primary() + .label("Let's Go!") + .on_click(|_, _, _| println!("Clicked!")), + ) + } } diff --git a/crates/state/Cargo.toml b/crates/state/Cargo.toml new file mode 100644 index 00000000..9abb248a --- /dev/null +++ b/crates/state/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "state" +version.workspace = true +edition.workspace = true +publish.workspace = true + +[dependencies] +common = { path = "../common" } + +nostr-sdk.workspace = true +nostr-lmdb.workspace = true + +gpui.workspace = true +smol.workspace = true +smallvec.workspace = true +log.workspace = true +anyhow.workspace = true +serde.workspace = true +serde_json.workspace = true + +rustls = "0.23.23" diff --git a/crates/state/src/lib.rs b/crates/state/src/lib.rs new file mode 100644 index 00000000..91c3eb96 --- /dev/null +++ b/crates/state/src/lib.rs @@ -0,0 +1,111 @@ +use std::time::Duration; + +use common::{config_dir, BOOTSTRAP_RELAYS, SEARCH_RELAYS}; +use gpui::{App, AppContext, Context, Entity, Global, Task}; +use nostr_lmdb::NostrLmdb; +use nostr_sdk::prelude::*; +use smallvec::{smallvec, SmallVec}; + +pub fn init(cx: &mut App) { + NostrRegistry::set_global(cx.new(NostrRegistry::new), cx); +} + +struct GlobalNostrRegistry(Entity); + +impl Global for GlobalNostrRegistry {} + +/// Nostr Registry +#[derive(Debug)] +pub struct NostrRegistry { + /// Nostr Client + client: Client, + + /// Tasks for asynchronous operations + _tasks: SmallVec<[Task<()>; 1]>, +} + +impl NostrRegistry { + /// Retrieve the global nostr state + pub fn global(cx: &App) -> Entity { + cx.global::().0.clone() + } + + /// Set the global nostr instance + fn set_global(state: Entity, cx: &mut App) { + cx.set_global(GlobalNostrRegistry(state)); + } + + /// Create a new nostr instance + fn new(cx: &mut Context) -> Self { + // rustls uses the `aws_lc_rs` provider by default + // This only errors if the default provider has already + // been installed. We can ignore this `Result`. + rustls::crypto::aws_lc_rs::default_provider() + .install_default() + .ok(); + + // Construct the nostr client options + let opts = ClientOptions::new() + .automatic_authentication(false) + .verify_subscriptions(false) + .sleep_when_idle(SleepWhenIdle::Enabled { + timeout: Duration::from_secs(600), + }); + + // Construct the lmdb + let lmdb = cx.background_executor().block(async move { + let path = config_dir().join("nostr"); + NostrLmdb::open(path) + .await + .expect("Failed to initialize database") + }); + + // Construct the nostr client + let client = ClientBuilder::default().database(lmdb).opts(opts).build(); + + let mut tasks = smallvec![]; + + tasks.push( + // Establish connection to the bootstrap relays + // + // And handle notifications from the nostr relay pool channel + cx.background_spawn({ + let client = client.clone(); + + async move { + // Connect to the bootstrap relays + Self::connect(&client).await; + + // Handle notifications from the relay pool + // Self::handle_notifications(&client, &gossip, &tracker).await; + } + }), + ); + + Self { + client, + _tasks: tasks, + } + } + + /// Establish connection to the bootstrap relays + async fn connect(client: &Client) { + // Get all bootstrapping relays + let mut urls = vec![]; + urls.extend(BOOTSTRAP_RELAYS); + urls.extend(SEARCH_RELAYS); + + // Add relay to the relay pool + for url in urls.into_iter() { + client.add_relay(url).await.ok(); + } + + // Connect to all added relays + client.connect().await; + } + + /// Get the nostr client instance + pub fn client(&self) -> Client { + self.client.clone() + } +} diff --git a/rust-toolchain.toml b/rust-toolchain.toml index e9326a9c..fd8efdd2 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.88" +channel = "1.90" profile = "minimal" components = ["rustfmt", "clippy"] targets = [