WIP

Nathan Sobo created

Change summary

Cargo.lock                          | 1 +
crates/gpui2/src/style.rs           | 2 ++
crates/refineable/src/refineable.rs | 6 ++++++
crates/storybook/Cargo.toml         | 1 +
crates/storybook/build.rs           | 5 +++++
5 files changed, 15 insertions(+)

Detailed changes

Cargo.lock 🔗

@@ -7378,6 +7378,7 @@ dependencies = [
  "anyhow",
  "gpui2",
  "log",
+ "refineable",
  "rust-embed",
  "serde",
  "settings",

crates/gpui2/src/style.rs 🔗

@@ -22,6 +22,8 @@ use gpui2_macros::styleable_helpers;
 use refineable::{Refineable, RefinementCascade};
 use std::sync::Arc;
 
+pub type StyleCascade = RefinementCascade<Style>;
+
 #[derive(Clone, Refineable, Debug)]
 #[refineable(debug)]
 pub struct Style {

crates/refineable/src/refineable.rs 🔗

@@ -17,6 +17,12 @@ pub trait Refineable: Clone {
     {
         Self::default().refined(refinement)
     }
+    fn from_cascade(cascade: &RefinementCascade<Self>) -> Self
+    where
+        Self: Default + Sized,
+    {
+        Self::default().refined(&cascade.merged())
+    }
 }
 
 pub struct RefinementCascade<S: Refineable>(Vec<Option<S::Refinement>>);

crates/storybook/Cargo.toml 🔗

@@ -12,6 +12,7 @@ path = "src/storybook.rs"
 gpui2 = { path = "../gpui2" }
 anyhow.workspace = true
 log.workspace = true
+refineable = { path = "../refineable" }
 rust-embed.workspace = true
 serde.workspace = true
 settings = { path = "../settings" }

crates/storybook/build.rs 🔗

@@ -0,0 +1,5 @@
+fn main() {
+    // Find WebRTC.framework as a sibling of the executable when running outside of an application bundle.
+    // TODO: We shouldn't depend on WebRTC in editor
+    println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path");
+}