mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-27 02:48:34 +00:00
WIP
This commit is contained in:
parent
0d31d6dac5
commit
1ef486b227
7 changed files with 1249 additions and 1561 deletions
11
Cargo.lock
generated
11
Cargo.lock
generated
|
@ -5303,6 +5303,7 @@ dependencies = [
|
|||
"gpui",
|
||||
"log",
|
||||
"optional_struct",
|
||||
"playground_macros",
|
||||
"serde",
|
||||
"simplelog",
|
||||
"smallvec",
|
||||
|
@ -5310,6 +5311,16 @@ dependencies = [
|
|||
"util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "playground_macros"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "plist"
|
||||
version = "1.5.0"
|
||||
|
|
|
@ -29,6 +29,7 @@ members = [
|
|||
"crates/go_to_line",
|
||||
"crates/gpui",
|
||||
"crates/gpui/playground",
|
||||
"crates/gpui/playground_macros",
|
||||
"crates/gpui_macros",
|
||||
"crates/install_cli",
|
||||
"crates/journal",
|
||||
|
|
|
@ -13,6 +13,7 @@ derive_more.workspace = true
|
|||
gpui = { path = ".." }
|
||||
log.workspace = true
|
||||
optional_struct = "0.3.1"
|
||||
playground_macros = { path = "../playground_macros" }
|
||||
serde.workspace = true
|
||||
simplelog = "0.9"
|
||||
smallvec.workspace = true
|
||||
|
|
|
@ -99,7 +99,7 @@ impl Into<gpui::color::Color> for Rgba {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
#[derive(Default, Copy, Clone, Debug, PartialEq)]
|
||||
pub struct Hsla {
|
||||
pub h: f32,
|
||||
pub s: f32,
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,9 +1,6 @@
|
|||
#![allow(dead_code, unused_variables)]
|
||||
|
||||
use gpui::{
|
||||
platform::{TitlebarOptions, WindowOptions},
|
||||
AnyElement, Element,
|
||||
};
|
||||
use gpui::{elements::Empty, Element};
|
||||
use log::LevelFilter;
|
||||
use simplelog::SimpleLogger;
|
||||
|
||||
|
@ -12,24 +9,21 @@ fn main() {
|
|||
|
||||
gpui::App::new(()).unwrap().run(|cx| {
|
||||
cx.platform().activate(true);
|
||||
cx.add_window(
|
||||
WindowOptions {
|
||||
titlebar: Some(TitlebarOptions {
|
||||
appears_transparent: true,
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
},
|
||||
|_| view(|_| Playground::new()),
|
||||
);
|
||||
// cx.add_window(
|
||||
// WindowOptions {
|
||||
// titlebar: Some(TitlebarOptions {
|
||||
// appears_transparent: true,
|
||||
// ..Default::default()
|
||||
// }),
|
||||
// ..Default::default()
|
||||
// },
|
||||
// |_| view(|_| Playground::new()),
|
||||
// );
|
||||
});
|
||||
}
|
||||
|
||||
use frame::{length::auto, *};
|
||||
use gpui::{LayoutContext, ViewContext};
|
||||
use std::{borrow::Cow, cell::RefCell, marker::PhantomData, rc::Rc};
|
||||
use themes::{rose_pine, ThemeColors};
|
||||
use tokens::{margin::m4, text::lg};
|
||||
use std::marker::PhantomData;
|
||||
use themes::ThemeColors;
|
||||
|
||||
mod color;
|
||||
mod frame;
|
||||
|
@ -45,19 +39,21 @@ impl<V> Playground<V> {
|
|||
}
|
||||
|
||||
pub fn render(&mut self, _: &mut V, _: &mut gpui::ViewContext<V>) -> impl Element<V> {
|
||||
workspace(&rose_pine::dawn())
|
||||
Empty::new()
|
||||
// workspace(&rose_pine::dawn())
|
||||
}
|
||||
}
|
||||
|
||||
fn workspace<V: 'static>(theme: &ThemeColors) -> impl Element<V> {
|
||||
column()
|
||||
// .size(auto())
|
||||
// .fill(theme.base(0.5))
|
||||
// .text_color(theme.text(0.5))
|
||||
// .child(title_bar(theme))
|
||||
// .child(stage(theme))
|
||||
// .child(status_bar(theme))
|
||||
}
|
||||
// fn workspace<V: 'static>(theme: &ThemeColors) -> impl Element<V> {
|
||||
// todo!()
|
||||
// // column()
|
||||
// // .size(auto())
|
||||
// // .fill(theme.base(0.5))
|
||||
// // .text_color(theme.text(0.5))
|
||||
// // .child(title_bar(theme))
|
||||
// // .child(stage(theme))
|
||||
// // .child(status_bar(theme))
|
||||
// }
|
||||
|
||||
// fn title_bar<V: 'static>(theme: &ThemeColors) -> impl Element<V> {
|
||||
// row()
|
||||
|
|
|
@ -8,159 +8,3 @@ pub mod color {
|
|||
scale([start_color, color, end_color])
|
||||
}
|
||||
}
|
||||
|
||||
pub mod text {
|
||||
use crate::frame::length::{rems, Rems};
|
||||
|
||||
pub fn xs() -> Rems {
|
||||
rems(0.75)
|
||||
}
|
||||
|
||||
pub fn sm() -> Rems {
|
||||
rems(0.875)
|
||||
}
|
||||
|
||||
pub fn base() -> Rems {
|
||||
rems(1.0)
|
||||
}
|
||||
|
||||
pub fn lg() -> Rems {
|
||||
rems(1.125)
|
||||
}
|
||||
|
||||
pub fn xl() -> Rems {
|
||||
rems(1.25)
|
||||
}
|
||||
|
||||
pub fn xxl() -> Rems {
|
||||
rems(1.5)
|
||||
}
|
||||
|
||||
pub fn xxxl() -> Rems {
|
||||
rems(1.875)
|
||||
}
|
||||
|
||||
pub fn xxxxl() -> Rems {
|
||||
rems(2.25)
|
||||
}
|
||||
|
||||
pub fn xxxxxl() -> Rems {
|
||||
rems(3.0)
|
||||
}
|
||||
|
||||
pub fn xxxxxxl() -> Rems {
|
||||
rems(4.0)
|
||||
}
|
||||
}
|
||||
|
||||
pub mod padding {
|
||||
use crate::frame::length::{rems, Rems};
|
||||
|
||||
pub fn p1() -> Rems {
|
||||
rems(0.25)
|
||||
}
|
||||
|
||||
pub fn p2() -> Rems {
|
||||
rems(0.5)
|
||||
}
|
||||
|
||||
pub fn p3() -> Rems {
|
||||
rems(0.75)
|
||||
}
|
||||
|
||||
pub fn p4() -> Rems {
|
||||
rems(1.0)
|
||||
}
|
||||
|
||||
pub fn p5() -> Rems {
|
||||
rems(1.25)
|
||||
}
|
||||
|
||||
pub fn p6() -> Rems {
|
||||
rems(1.5)
|
||||
}
|
||||
|
||||
pub fn p8() -> Rems {
|
||||
rems(2.0)
|
||||
}
|
||||
|
||||
pub fn p10() -> Rems {
|
||||
rems(2.5)
|
||||
}
|
||||
|
||||
pub fn p12() -> Rems {
|
||||
rems(3.0)
|
||||
}
|
||||
|
||||
pub fn p16() -> Rems {
|
||||
rems(4.0)
|
||||
}
|
||||
|
||||
pub fn p20() -> Rems {
|
||||
rems(5.0)
|
||||
}
|
||||
|
||||
pub fn p24() -> Rems {
|
||||
rems(6.0)
|
||||
}
|
||||
|
||||
pub fn p32() -> Rems {
|
||||
rems(8.0)
|
||||
}
|
||||
}
|
||||
|
||||
pub mod margin {
|
||||
use crate::frame::length::{rems, Rems};
|
||||
|
||||
pub fn m1() -> Rems {
|
||||
rems(0.25)
|
||||
}
|
||||
|
||||
pub fn m2() -> Rems {
|
||||
rems(0.5)
|
||||
}
|
||||
|
||||
pub fn m3() -> Rems {
|
||||
rems(0.75)
|
||||
}
|
||||
|
||||
pub fn m4() -> Rems {
|
||||
rems(1.0)
|
||||
}
|
||||
|
||||
pub fn m5() -> Rems {
|
||||
rems(1.25)
|
||||
}
|
||||
|
||||
pub fn m6() -> Rems {
|
||||
rems(1.5)
|
||||
}
|
||||
|
||||
pub fn m8() -> Rems {
|
||||
rems(2.0)
|
||||
}
|
||||
|
||||
pub fn m10() -> Rems {
|
||||
rems(2.5)
|
||||
}
|
||||
|
||||
pub fn m12() -> Rems {
|
||||
rems(3.0)
|
||||
}
|
||||
|
||||
pub fn m16() -> Rems {
|
||||
rems(4.0)
|
||||
}
|
||||
|
||||
pub fn m20() -> Rems {
|
||||
rems(5.0)
|
||||
}
|
||||
|
||||
pub fn m24() -> Rems {
|
||||
rems(6.0)
|
||||
}
|
||||
|
||||
pub fn m32() -> Rems {
|
||||
rems(8.0)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue