cronixui 1.0.6 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/README.md +20 -5
  2. package/package.json +20 -5
  3. package/packages/flutter/lib/cronixui.dart +41 -0
  4. package/packages/flutter/lib/src/tokens/colors.dart +34 -0
  5. package/packages/flutter/lib/src/tokens/spacing.dart +54 -0
  6. package/packages/flutter/lib/src/tokens/theme.dart +174 -0
  7. package/packages/flutter/lib/src/widgets/cn_accordion.dart +254 -0
  8. package/packages/flutter/lib/src/widgets/cn_alert.dart +137 -0
  9. package/packages/flutter/lib/src/widgets/cn_avatar.dart +98 -0
  10. package/packages/flutter/lib/src/widgets/cn_badge.dart +80 -0
  11. package/packages/flutter/lib/src/widgets/cn_breadcrumb.dart +88 -0
  12. package/packages/flutter/lib/src/widgets/cn_button.dart +137 -0
  13. package/packages/flutter/lib/src/widgets/cn_card.dart +99 -0
  14. package/packages/flutter/lib/src/widgets/cn_checkbox.dart +77 -0
  15. package/packages/flutter/lib/src/widgets/cn_command_palette.dart +299 -0
  16. package/packages/flutter/lib/src/widgets/cn_container.dart +131 -0
  17. package/packages/flutter/lib/src/widgets/cn_dropdown.dart +149 -0
  18. package/packages/flutter/lib/src/widgets/cn_file_input.dart +113 -0
  19. package/packages/flutter/lib/src/widgets/cn_footer.dart +108 -0
  20. package/packages/flutter/lib/src/widgets/cn_header.dart +173 -0
  21. package/packages/flutter/lib/src/widgets/cn_input.dart +142 -0
  22. package/packages/flutter/lib/src/widgets/cn_list.dart +150 -0
  23. package/packages/flutter/lib/src/widgets/cn_modal.dart +213 -0
  24. package/packages/flutter/lib/src/widgets/cn_nav.dart +157 -0
  25. package/packages/flutter/lib/src/widgets/cn_pagination.dart +193 -0
  26. package/packages/flutter/lib/src/widgets/cn_progress.dart +146 -0
  27. package/packages/flutter/lib/src/widgets/cn_radio.dart +133 -0
  28. package/packages/flutter/lib/src/widgets/cn_search.dart +183 -0
  29. package/packages/flutter/lib/src/widgets/cn_select.dart +244 -0
  30. package/packages/flutter/lib/src/widgets/cn_sidebar.dart +207 -0
  31. package/packages/flutter/lib/src/widgets/cn_skeleton.dart +136 -0
  32. package/packages/flutter/lib/src/widgets/cn_slider.dart +141 -0
  33. package/packages/flutter/lib/src/widgets/cn_spinner.dart +85 -0
  34. package/packages/flutter/lib/src/widgets/cn_stat.dart +135 -0
  35. package/packages/flutter/lib/src/widgets/cn_table.dart +136 -0
  36. package/packages/flutter/lib/src/widgets/cn_tabs.dart +229 -0
  37. package/packages/flutter/lib/src/widgets/cn_tag.dart +185 -0
  38. package/packages/flutter/lib/src/widgets/cn_textarea.dart +143 -0
  39. package/packages/flutter/lib/src/widgets/cn_toast.dart +121 -0
  40. package/packages/flutter/lib/src/widgets/cn_toggle.dart +78 -0
  41. package/packages/flutter/lib/src/widgets/cn_tooltip.dart +118 -0
  42. package/packages/flutter/pubspec.yaml +20 -0
  43. package/packages/go/cronixui/cronixui.go +784 -237
  44. package/packages/go/cronixui/go.mod +32 -0
  45. package/packages/go/cronixui/go.sum +666 -0
  46. package/packages/python/cronixui/__init__.py +59 -3
  47. package/packages/python/cronixui/alert.py +61 -0
  48. package/packages/python/cronixui/avatar.py +50 -0
  49. package/packages/python/cronixui/badge.py +46 -0
  50. package/packages/python/cronixui/button.py +64 -0
  51. package/packages/python/cronixui/card.py +62 -0
  52. package/packages/python/cronixui/form.py +255 -0
  53. package/packages/python/cronixui/layout.py +143 -0
  54. package/packages/python/cronixui/list.py +51 -0
  55. package/packages/python/cronixui/loading.py +36 -0
  56. package/packages/python/cronixui/progress.py +90 -0
  57. package/packages/python/cronixui/table.py +48 -0
  58. package/packages/python/cronixui/tooltip.py +28 -0
  59. package/packages/react/src/components/Accordion.tsx +82 -0
  60. package/packages/react/src/components/Alert.tsx +80 -0
  61. package/packages/react/src/components/Avatar.tsx +54 -0
  62. package/packages/react/src/components/Badge.tsx +32 -0
  63. package/packages/react/src/components/Breadcrumb.tsx +50 -0
  64. package/packages/react/src/components/Button.tsx +47 -0
  65. package/packages/react/src/components/Card.tsx +69 -0
  66. package/packages/react/src/components/Checkbox.tsx +30 -0
  67. package/packages/react/src/components/CommandPalette.tsx +131 -0
  68. package/packages/react/src/components/Container.tsx +26 -0
  69. package/packages/react/src/components/Dropdown.tsx +88 -0
  70. package/packages/react/src/components/FileInput.tsx +86 -0
  71. package/packages/react/src/components/Footer.tsx +36 -0
  72. package/packages/react/src/components/FormGroup.tsx +36 -0
  73. package/packages/react/src/components/Header.tsx +29 -0
  74. package/packages/react/src/components/Input.tsx +54 -0
  75. package/packages/react/src/components/List.tsx +55 -0
  76. package/packages/react/src/components/Modal.tsx +89 -0
  77. package/packages/react/src/components/Nav.tsx +63 -0
  78. package/packages/react/src/components/Pagination.tsx +107 -0
  79. package/packages/react/src/components/Progress.tsx +49 -0
  80. package/packages/react/src/components/Radio.tsx +64 -0
  81. package/packages/react/src/components/Search.tsx +95 -0
  82. package/packages/react/src/components/Select.tsx +41 -0
  83. package/packages/react/src/components/Sidebar.tsx +64 -0
  84. package/packages/react/src/components/Skeleton.tsx +39 -0
  85. package/packages/react/src/components/Slider.tsx +32 -0
  86. package/packages/react/src/components/Spinner.tsx +24 -0
  87. package/packages/react/src/components/Stack.tsx +69 -0
  88. package/packages/react/src/components/Stat.tsx +35 -0
  89. package/packages/react/src/components/Table.tsx +90 -0
  90. package/packages/react/src/components/Tabs.tsx +85 -0
  91. package/packages/react/src/components/Tag.tsx +30 -0
  92. package/packages/react/src/components/Textarea.tsx +21 -0
  93. package/packages/react/src/components/Toast.tsx +134 -0
  94. package/packages/react/src/components/Toggle.tsx +58 -0
  95. package/packages/react/src/components/Tooltip.tsx +31 -0
  96. package/packages/react/src/components/Typography.tsx +66 -0
  97. package/packages/react/src/index.ts +40 -0
  98. package/packages/react/src/styles.css +2039 -0
  99. package/packages/react/src/tokens/index.ts +94 -0
  100. package/packages/rust/cronixui/src/colors.rs +135 -0
  101. package/packages/rust/cronixui/src/components/accordion.rs +47 -0
  102. package/packages/rust/cronixui/src/components/alert.rs +95 -0
  103. package/packages/rust/cronixui/src/components/avatar.rs +85 -0
  104. package/packages/rust/cronixui/src/components/badge.rs +35 -0
  105. package/packages/rust/cronixui/src/components/breadcrumb.rs +58 -0
  106. package/packages/rust/cronixui/src/components/button.rs +70 -0
  107. package/packages/rust/cronixui/src/components/card.rs +259 -0
  108. package/packages/rust/cronixui/src/components/command_palette.rs +254 -0
  109. package/packages/rust/cronixui/src/components/dropdown.rs +179 -0
  110. package/packages/rust/cronixui/src/components/file_input.rs +74 -0
  111. package/packages/rust/cronixui/src/components/input.rs +21 -0
  112. package/packages/rust/cronixui/src/components/list.rs +38 -0
  113. package/packages/rust/cronixui/src/components/mod.rs +51 -0
  114. package/packages/rust/cronixui/src/{modal.rs → components/modal.rs} +15 -1
  115. package/packages/rust/cronixui/src/components/nav.rs +19 -0
  116. package/packages/rust/cronixui/src/{pagination.rs → components/pagination.rs} +14 -13
  117. package/packages/rust/cronixui/src/components/progress.rs +50 -0
  118. package/packages/rust/cronixui/src/components/search.rs +185 -0
  119. package/packages/rust/cronixui/src/components/skeleton.rs +63 -0
  120. package/packages/rust/cronixui/src/components/spinner.rs +21 -0
  121. package/packages/rust/cronixui/src/components/table.rs +56 -0
  122. package/packages/rust/cronixui/src/components/tabs.rs +43 -0
  123. package/packages/rust/cronixui/src/components/toast.rs +69 -0
  124. package/packages/rust/cronixui/src/{toggle.rs → components/toggle.rs} +7 -5
  125. package/packages/rust/cronixui/src/components/tooltip.rs +11 -0
  126. package/packages/rust/cronixui/src/lib.rs +111 -64
  127. package/packages/rust/cronixui/src/tokens.rs +97 -127
  128. package/packages/web/src/variables.css +81 -81
  129. package/packages/go/cronixui/tokens.go +0 -129
  130. package/packages/python/cronixui/pyproject.toml +0 -11
  131. package/packages/react/src/components/Accordion.jsx +0 -50
  132. package/packages/react/src/components/Alert.jsx +0 -62
  133. package/packages/react/src/components/Avatar.jsx +0 -34
  134. package/packages/react/src/components/Badge.jsx +0 -15
  135. package/packages/react/src/components/Breadcrumb.jsx +0 -27
  136. package/packages/react/src/components/Button.jsx +0 -21
  137. package/packages/react/src/components/Card.jsx +0 -23
  138. package/packages/react/src/components/Checkbox.jsx +0 -27
  139. package/packages/react/src/components/CommandPalette.jsx +0 -93
  140. package/packages/react/src/components/Dropdown.jsx +0 -48
  141. package/packages/react/src/components/FileInput.jsx +0 -44
  142. package/packages/react/src/components/Input.jsx +0 -22
  143. package/packages/react/src/components/List.jsx +0 -29
  144. package/packages/react/src/components/Modal.jsx +0 -65
  145. package/packages/react/src/components/Nav.jsx +0 -50
  146. package/packages/react/src/components/Pagination.jsx +0 -81
  147. package/packages/react/src/components/Progress.jsx +0 -23
  148. package/packages/react/src/components/Radio.jsx +0 -50
  149. package/packages/react/src/components/Search.jsx +0 -70
  150. package/packages/react/src/components/Select.jsx +0 -33
  151. package/packages/react/src/components/Skeleton.jsx +0 -15
  152. package/packages/react/src/components/Slider.jsx +0 -29
  153. package/packages/react/src/components/Spinner.jsx +0 -5
  154. package/packages/react/src/components/Stat.jsx +0 -19
  155. package/packages/react/src/components/Table.jsx +0 -48
  156. package/packages/react/src/components/Tabs.jsx +0 -65
  157. package/packages/react/src/components/Tag.jsx +0 -19
  158. package/packages/react/src/components/Textarea.jsx +0 -17
  159. package/packages/react/src/components/Toast.jsx +0 -78
  160. package/packages/react/src/components/Toggle.jsx +0 -34
  161. package/packages/react/src/components/Tooltip.jsx +0 -12
  162. package/packages/react/src/index.d.ts +0 -103
  163. package/packages/react/src/index.js +0 -33
  164. package/packages/rust/cronixui/src/accordion.rs +0 -49
  165. package/packages/rust/cronixui/src/command_palette.rs +0 -62
  166. package/packages/rust/cronixui/src/dropdown.rs +0 -31
  167. package/packages/rust/cronixui/src/search.rs +0 -49
  168. package/packages/rust/cronixui/src/tabs.rs +0 -23
  169. package/packages/rust/cronixui/src/toast.rs +0 -70
@@ -0,0 +1,69 @@
1
+ //! Toast notifications
2
+
3
+ use crate::colors::*;
4
+ use egui::Color32;
5
+
6
+ pub enum ToastType {
7
+ Success,
8
+ Error,
9
+ Warning,
10
+ Info,
11
+ }
12
+
13
+ pub struct Toast {
14
+ pub message: String,
15
+ pub toast_type: ToastType,
16
+ pub duration: f32,
17
+ }
18
+
19
+ impl Toast {
20
+ pub fn success(message: impl Into<String>) -> Self {
21
+ Self {
22
+ message: message.into(),
23
+ toast_type: ToastType::Success,
24
+ duration: 3.0,
25
+ }
26
+ }
27
+
28
+ pub fn error(message: impl Into<String>) -> Self {
29
+ Self {
30
+ message: message.into(),
31
+ toast_type: ToastType::Error,
32
+ duration: 3.0,
33
+ }
34
+ }
35
+
36
+ pub fn warning(message: impl Into<String>) -> Self {
37
+ Self {
38
+ message: message.into(),
39
+ toast_type: ToastType::Warning,
40
+ duration: 3.0,
41
+ }
42
+ }
43
+
44
+ pub fn info(message: impl Into<String>) -> Self {
45
+ Self {
46
+ message: message.into(),
47
+ toast_type: ToastType::Info,
48
+ duration: 3.0,
49
+ }
50
+ }
51
+
52
+ pub fn color(&self) -> Color32 {
53
+ match self.toast_type {
54
+ ToastType::Success => SUCCESS,
55
+ ToastType::Error => ERROR,
56
+ ToastType::Warning => WARNING,
57
+ ToastType::Info => INFO,
58
+ }
59
+ }
60
+
61
+ pub fn prefix(&self) -> &'static str {
62
+ match self.toast_type {
63
+ ToastType::Success => "✓ ",
64
+ ToastType::Error => "✕ ",
65
+ ToastType::Warning => "⚠ ",
66
+ ToastType::Info => "ℹ ",
67
+ }
68
+ }
69
+ }
@@ -1,5 +1,7 @@
1
+ //! Toggle component
2
+
1
3
  pub struct Toggle {
2
- on: bool,
4
+ pub on: bool,
3
5
  }
4
6
 
5
7
  impl Toggle {
@@ -11,12 +13,12 @@ impl Toggle {
11
13
  self.on = !self.on;
12
14
  }
13
15
 
14
- pub fn is_on(&self) -> bool {
15
- self.on
16
+ pub fn set(&mut self, value: bool) {
17
+ self.on = value;
16
18
  }
17
19
 
18
- pub fn set_on(&mut self, value: bool) {
19
- self.on = value;
20
+ pub fn is_on(&self) -> bool {
21
+ self.on
20
22
  }
21
23
  }
22
24
 
@@ -0,0 +1,11 @@
1
+ //! Tooltip component
2
+
3
+ pub struct Tooltip {
4
+ pub content: String,
5
+ }
6
+
7
+ impl Tooltip {
8
+ pub fn new(content: impl Into<String>) -> Self {
9
+ Self { content: content.into() }
10
+ }
11
+ }
@@ -1,81 +1,128 @@
1
- //! CronixUI - A dark-themed UI toolkit with crimson accents and Outfit typography
1
+ //! CronixUI - A dark-themed UI toolkit for egui
2
2
  //!
3
3
  //! ## Example
4
4
  //!
5
5
  //! ```rust
6
- //! use cronixui::{Toast, Toggle, Modal};
6
+ //! use cronixui::{CronixUI, Colors, components::*};
7
7
  //!
8
- //! // Create a toast
9
- //! let toast = Toast::success("Operation completed!");
10
- //!
11
- //! // Create a toggle
12
- //! let mut toggle = Toggle::new();
13
- //! toggle.toggle();
14
- //! assert!(toggle.is_on());
8
+ //! // In your egui app
9
+ //! fn update(&mut self, ctx: &egui::Context) {
10
+ //! CronixUI::apply_theme(ctx);
11
+ //!
12
+ //! egui::CentralPanel::default().show(ctx, |ui| {
13
+ //! // Use components
14
+ //! if ui.button_primary("Click me").clicked() {
15
+ //! // handle click
16
+ //! }
17
+ //! });
18
+ //! }
15
19
  //! ```
16
20
 
17
- pub const VERSION: &str = "1.0.4";
18
-
19
- mod toast;
20
- mod toggle;
21
- mod modal;
22
- mod dropdown;
23
- mod tabs;
24
- mod accordion;
25
- mod pagination;
26
- mod command_palette;
27
- mod search;
28
- mod tokens;
21
+ pub mod colors;
22
+ pub mod tokens;
23
+ pub mod components;
29
24
 
30
- pub use toast::{Toast, ToastType};
31
- pub use toggle::Toggle;
32
- pub use modal::Modal;
33
- pub use dropdown::Dropdown;
34
- pub use tabs::Tabs;
35
- pub use accordion::Accordion;
36
- pub use pagination::Pagination;
37
- pub use command_palette::{CommandPalette, CommandPaletteItem};
38
- pub use search::{Search, SearchItem};
25
+ pub use colors::*;
39
26
  pub use tokens::*;
27
+ pub use components::*;
28
+
29
+ use egui::{Color32, Vec2, Rounding};
40
30
 
41
- /// Initialize CronixUI
42
- pub fn init() {
43
- println!("CronixUI {} initialized", VERSION);
31
+ /// Current version
32
+ pub const VERSION: &str = "1.0.6";
33
+
34
+ /// Apply CronixUI theme to egui context
35
+ pub fn apply_theme(ctx: &egui::Context) {
36
+ let colors = Colors::default();
37
+
38
+ let mut style = (*ctx.style()).clone();
39
+
40
+ // Visuals
41
+ style.visuals.window_fill = colors.bg;
42
+ style.visuals.panel_fill = colors.bg;
43
+ style.visuals.extreme_bg_color = colors.surface;
44
+ style.visuals.faint_bg_color = colors.surface_2;
45
+ style.visuals.code_bg_color = colors.surface_3;
46
+
47
+ // Text colors
48
+ style.visuals.strong_text_color = colors.text;
49
+ style.visuals.weak_text_color = colors.text_muted;
50
+ style.visuals.text_color = colors.text;
51
+
52
+ // Widget colors
53
+ style.visuals.widgets.noninteractive.bg_fill = colors.surface;
54
+ style.visuals.widgets.noninteractive.bg_stroke.color = colors.border;
55
+ style.visuals.widgets.noninteractive.fg_stroke.color = colors.text;
56
+
57
+ style.visuals.widgets.inactive.bg_fill = colors.surface_2;
58
+ style.visuals.widgets.inactive.bg_stroke.color = colors.border;
59
+ style.visuals.widgets.inactive.fg_stroke.color = colors.text;
60
+
61
+ style.visuals.widgets.hovered.bg_fill = colors.surface_3;
62
+ style.visuals.widgets.hovered.bg_stroke.color = colors.border_hover;
63
+ style.visuals.widgets.hovered.fg_stroke.color = colors.text;
64
+
65
+ style.visuals.widgets.active.bg_fill = colors.accent;
66
+ style.visuals.widgets.active.bg_stroke.color = colors.accent;
67
+ style.visuals.widgets.active.fg_stroke.color = colors.text;
68
+
69
+ style.visuals.widgets.open.bg_fill = colors.surface_3;
70
+ style.visuals.widgets.open.bg_stroke.color = colors.accent;
71
+
72
+ // Selection
73
+ style.visuals.selection.bg_fill = colors.accent;
74
+ style.visuals.selection.stroke.color = colors.accent_text;
75
+
76
+ // Hyperlink
77
+ style.visuals.hyperlink_color = colors.accent_text;
78
+
79
+ // Button rounding
80
+ style.visuals.button_rounding = Rounding::same(tokens::RADIUS);
81
+
82
+ // Window rounding
83
+ style.visuals.window_rounding = Rounding::same(tokens::RADIUS_LG);
84
+
85
+ // Spacing
86
+ style.spacing.button_padding = Vec2::new(tokens::SPACE_4, tokens::SPACE_2);
87
+ style.spacing.item_spacing = Vec2::new(tokens::SPACE_2, tokens::SPACE_2);
88
+ style.spacing.indent = tokens::SPACE_4;
89
+
90
+ ctx.set_style(style);
44
91
  }
45
92
 
46
- #[cfg(test)]
47
- mod tests {
48
- use super::*;
93
+ /// Helper trait for CronixUI button variants
94
+ pub trait CronixButton {
95
+ fn button_primary(&mut self, text: &str) -> egui::Response;
96
+ fn button_danger(&mut self, text: &str) -> egui::Response;
97
+ fn button_success(&mut self, text: &str) -> egui::Response;
98
+ fn button_ghost(&mut self, text: &str) -> egui::Response;
99
+ fn button_outline(&mut self, text: &str) -> egui::Response;
100
+ }
49
101
 
50
- #[test]
51
- fn test_toggle() {
52
- let mut toggle = Toggle::new();
53
- assert!(!toggle.is_on());
54
- toggle.toggle();
55
- assert!(toggle.is_on());
56
- toggle.set_on(false);
57
- assert!(!toggle.is_on());
102
+ impl CronixButton for egui::Ui {
103
+ fn button_primary(&mut self, text: &str) -> egui::Response {
104
+ let colors = Colors::default();
105
+ self.add(egui::Button::new(text).fill(colors.accent))
58
106
  }
59
-
60
- #[test]
61
- fn test_pagination() {
62
- let mut pagination = Pagination::new(10, 1);
63
- assert_eq!(pagination.current(), 1);
64
- pagination.next();
65
- assert_eq!(pagination.current(), 2);
66
- pagination.go_to(5);
67
- assert_eq!(pagination.current(), 5);
107
+
108
+ fn button_danger(&mut self, text: &str) -> egui::Response {
109
+ let colors = Colors::default();
110
+ self.add(egui::Button::new(text).fill(colors.error))
68
111
  }
69
-
70
- #[test]
71
- fn test_search() {
72
- let mut search = Search::new();
73
- search.set_items(vec![
74
- SearchItem::new("Apple"),
75
- SearchItem::new("Banana"),
76
- SearchItem::new("Apricot"),
77
- ]);
78
- let results = search.filter("ap");
79
- assert_eq!(results.len(), 2);
112
+
113
+ fn button_success(&mut self, text: &str) -> egui::Response {
114
+ let colors = Colors::default();
115
+ self.add(egui::Button::new(text).fill(colors.success))
116
+ }
117
+
118
+ fn button_ghost(&mut self, text: &str) -> egui::Response {
119
+ self.add(egui::Button::new(text).fill(Color32::TRANSPARENT))
120
+ }
121
+
122
+ fn button_outline(&mut self, text: &str) -> egui::Response {
123
+ let colors = Colors::default();
124
+ self.add(egui::Button::new(text)
125
+ .fill(Color32::TRANSPARENT)
126
+ .stroke(egui::Stroke::new(1.0, colors.border)))
80
127
  }
81
128
  }
@@ -1,137 +1,107 @@
1
1
  //! Design tokens for CronixUI
2
2
 
3
- use std::fmt;
4
-
5
- /// Color representation
6
- #[derive(Debug, Clone, Copy)]
7
- pub struct Color {
8
- pub hex: &'static str,
9
- pub r: u8,
10
- pub g: u8,
11
- pub b: u8,
3
+ use egui::{vec2, Rounding};
4
+
5
+ // =============================================================================
6
+ // TYPOGRAPHY TOKENS
7
+ // =============================================================================
8
+
9
+ pub const FONT_FAMILY: &str = "Outfit";
10
+ pub const FONT_MONO: &str = "JetBrains Mono";
11
+
12
+ pub const FONT_SIZE_XS: f32 = 11.0;
13
+ pub const FONT_SIZE_SM: f32 = 12.0;
14
+ pub const FONT_SIZE_BASE: f32 = 13.0;
15
+ pub const FONT_SIZE_MD: f32 = 14.0;
16
+ pub const FONT_SIZE_LG: f32 = 16.0;
17
+ pub const FONT_SIZE_XL: f32 = 20.0;
18
+ pub const FONT_SIZE_2XL: f32 = 28.0;
19
+ pub const FONT_SIZE_3XL: f32 = 36.0;
20
+
21
+ // =============================================================================
22
+ // SPACING TOKENS
23
+ // =============================================================================
24
+
25
+ pub const SPACE_1: f32 = 4.0;
26
+ pub const SPACE_2: f32 = 8.0;
27
+ pub const SPACE_3: f32 = 12.0;
28
+ pub const SPACE_4: f32 = 16.0;
29
+ pub const SPACE_5: f32 = 20.0;
30
+ pub const SPACE_6: f32 = 24.0;
31
+ pub const SPACE_8: f32 = 32.0;
32
+ pub const SPACE_10: f32 = 40.0;
33
+ pub const SPACE_12: f32 = 48.0;
34
+
35
+ // =============================================================================
36
+ // BORDER RADIUS TOKENS
37
+ // =============================================================================
38
+
39
+ pub const RADIUS_SM: f32 = 6.0;
40
+ pub const RADIUS: f32 = 10.0;
41
+ pub const RADIUS_LG: f32 = 14.0;
42
+ pub const RADIUS_XL: f32 = 20.0;
43
+ pub const RADIUS_FULL: f32 = 9999.0;
44
+
45
+ /// Get rounded corners
46
+ pub fn rounded() -> Rounding {
47
+ Rounding::same(RADIUS)
12
48
  }
13
49
 
14
- impl fmt::Display for Color {
15
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
16
- write!(f, "{}", self.hex)
17
- }
50
+ pub fn rounded_sm() -> Rounding {
51
+ Rounding::same(RADIUS_SM)
18
52
  }
19
53
 
20
- // Background colors
21
- pub const BG: Color = Color { hex: "#0a0a0a", r: 10, g: 10, b: 10 };
22
- pub const SURFACE: Color = Color { hex: "#111111", r: 17, g: 17, b: 17 };
23
- pub const SURFACE_2: Color = Color { hex: "#1a1a1a", r: 26, g: 26, b: 26 };
24
- pub const SURFACE_3: Color = Color { hex: "#222222", r: 34, g: 34, b: 34 };
25
- pub const SURFACE_4: Color = Color { hex: "#2a2a2a", r: 42, g: 42, b: 42 };
26
-
27
- // Text colors
28
- pub const TEXT: Color = Color { hex: "#f0ede8", r: 240, g: 237, b: 232 };
29
- pub const TEXT_MUTED: &str = "rgba(240, 237, 232, 0.5)";
30
- pub const TEXT_DIM: &str = "rgba(240, 237, 232, 0.25)";
31
-
32
- // Accent colors (Crimson)
33
- pub const ACCENT: Color = Color { hex: "#6b2323", r: 107, g: 35, b: 35 };
34
- pub const ACCENT_HOVER: Color = Color { hex: "#7d2a2a", r: 125, g: 42, b: 42 };
35
- pub const ACCENT_LIGHT: Color = Color { hex: "#8a3535", r: 138, g: 53, b: 53 };
36
- pub const ACCENT_GLOW: &str = "rgba(107, 35, 35, 0.3)";
37
- pub const ACCENT_TEXT: Color = Color { hex: "#c97a7a", r: 201, g: 122, b: 122 };
38
-
39
- // Semantic colors - Success
40
- pub const SUCCESS: Color = Color { hex: "#1e5028", r: 30, g: 80, b: 40 };
41
- pub const SUCCESS_BORDER: &str = "rgba(60, 140, 70, 0.4)";
42
- pub const SUCCESS_TEXT: Color = Color { hex: "#6bc47a", r: 107, g: 196, b: 122 };
43
-
44
- // Semantic colors - Warning
45
- pub const WARNING: Color = Color { hex: "#503c14", r: 80, g: 60, b: 20 };
46
- pub const WARNING_BORDER: &str = "rgba(150, 110, 30, 0.4)";
47
- pub const WARNING_TEXT: Color = Color { hex: "#c4a43a", r: 196, g: 164, b: 58 };
48
-
49
- // Semantic colors - Error
50
- pub const ERROR: Color = Color { hex: "#501414", r: 80, g: 20, b: 20 };
51
- pub const ERROR_BORDER: &str = "rgba(180, 60, 60, 0.4)";
52
- pub const ERROR_TEXT: Color = Color { hex: "#c46b6b", r: 196, g: 107, b: 107 };
53
-
54
- // Semantic colors - Info
55
- pub const INFO: Color = Color { hex: "#143550", r: 20, g: 53, b: 80 };
56
- pub const INFO_BORDER: &str = "rgba(60, 140, 200, 0.4)";
57
- pub const INFO_TEXT: Color = Color { hex: "#6ba8c4", r: 107, g: 168, b: 196 };
58
-
59
- // Border colors
60
- pub const BORDER: &str = "rgba(255, 255, 255, 0.08)";
61
- pub const BORDER_HOVER: &str = "rgba(255, 255, 255, 0.15)";
62
- pub const BORDER_FOCUS: &str = "rgba(255, 255, 255, 0.25)";
63
-
64
- // Typography
65
- pub const FONT_FAMILY: &str = "'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";
66
- pub const FONT_MONO: &str = "'JetBrains Mono', 'Fira Code', 'Consolas', monospace";
67
-
68
- pub const FONT_SIZE_XS: u8 = 11;
69
- pub const FONT_SIZE_SM: u8 = 12;
70
- pub const FONT_SIZE_BASE: u8 = 13;
71
- pub const FONT_SIZE_MD: u8 = 14;
72
- pub const FONT_SIZE_LG: u8 = 16;
73
- pub const FONT_SIZE_XL: u8 = 20;
74
- pub const FONT_SIZE_2XL: u8 = 28;
75
- pub const FONT_SIZE_3XL: u8 = 36;
76
-
77
- // Spacing
78
- pub const SPACE_1: u8 = 4;
79
- pub const SPACE_2: u8 = 8;
80
- pub const SPACE_3: u8 = 12;
81
- pub const SPACE_4: u8 = 16;
82
- pub const SPACE_5: u8 = 20;
83
- pub const SPACE_6: u8 = 24;
84
- pub const SPACE_8: u8 = 32;
85
- pub const SPACE_10: u8 = 40;
86
- pub const SPACE_12: u8 = 48;
87
-
88
- // Border radius
89
- pub const RADIUS_SM: u8 = 6;
90
- pub const RADIUS: u8 = 10;
91
- pub const RADIUS_LG: u8 = 14;
92
- pub const RADIUS_XL: u8 = 20;
93
- pub const RADIUS_FULL: u16 = 9999;
94
-
95
- // Shadows
54
+ pub fn rounded_lg() -> Rounding {
55
+ Rounding::same(RADIUS_LG)
56
+ }
57
+
58
+ // =============================================================================
59
+ // Z-INDEX TOKENS
60
+ // =============================================================================
61
+
62
+ pub const Z_INDEX_DROPDOWN: f32 = 100.0;
63
+ pub const Z_INDEX_STICKY: f32 = 200.0;
64
+ pub const Z_INDEX_FIXED: f32 = 300.0;
65
+ pub const Z_INDEX_MODAL_BACKDROP: f32 = 400.0;
66
+ pub const Z_INDEX_MODAL: f32 = 500.0;
67
+ pub const Z_INDEX_POPOVER: f32 = 600.0;
68
+ pub const Z_INDEX_TOOLTIP: f32 = 700.0;
69
+ pub const Z_INDEX_TOAST: f32 = 800.0;
70
+
71
+ // =============================================================================
72
+ // LAYOUT TOKENS
73
+ // =============================================================================
74
+
75
+ pub const CONTAINER_MAX: f32 = 1200.0;
76
+ pub const SIDEBAR_WIDTH: f32 = 260.0;
77
+ pub const HEADER_HEIGHT: f32 = 60.0;
78
+
79
+ // =============================================================================
80
+ // SHADOW TOKENS (as string descriptions)
81
+ // =============================================================================
82
+
96
83
  pub const SHADOW_SM: &str = "0 1px 2px rgba(0, 0, 0, 0.3)";
97
84
  pub const SHADOW: &str = "0 4px 12px rgba(0, 0, 0, 0.4)";
98
85
  pub const SHADOW_LG: &str = "0 8px 24px rgba(0, 0, 0, 0.5)";
99
- pub const SHADOW_GLOW: &str = "0 0 20px rgba(107, 35, 35, 0.3)";
100
-
101
- // Transitions
102
- pub const TRANSITION_FAST: &str = "0.1s ease";
103
- pub const TRANSITION_DEFAULT: &str = "0.15s ease";
104
- pub const TRANSITION_SLOW: &str = "0.25s ease";
105
-
106
- // Z-index
107
- pub const Z_INDEX_DROPDOWN: u16 = 100;
108
- pub const Z_INDEX_STICKY: u16 = 200;
109
- pub const Z_INDEX_FIXED: u16 = 300;
110
- pub const Z_INDEX_MODAL_BACKDROP: u16 = 400;
111
- pub const Z_INDEX_MODAL: u16 = 500;
112
- pub const Z_INDEX_POPOVER: u16 = 600;
113
- pub const Z_INDEX_TOOLTIP: u16 = 700;
114
- pub const Z_INDEX_TOAST: u16 = 800;
115
-
116
- // Layout
117
- pub const CONTAINER_MAX: u16 = 1200;
118
- pub const SIDEBAR_WIDTH: u16 = 260;
119
-
120
- #[cfg(test)]
121
- mod tests {
122
- use super::*;
123
-
124
- #[test]
125
- fn test_colors() {
126
- assert_eq!(BG.hex, "#0a0a0a");
127
- assert_eq!(ACCENT.hex, "#6b2323");
128
- assert_eq!(TEXT.r, 240);
129
- }
130
-
131
- #[test]
132
- fn test_spacing() {
133
- assert_eq!(SPACE_1, 4);
134
- assert_eq!(SPACE_4, 16);
135
- assert_eq!(SPACE_12, 48);
136
- }
86
+
87
+ // =============================================================================
88
+ // TRANSITION TOKENS
89
+ // =============================================================================
90
+
91
+ pub const TRANSITION_FAST: f32 = 0.1;
92
+ pub const TRANSITION: f32 = 0.15;
93
+ pub const TRANSITION_SLOW: f32 = 0.25;
94
+
95
+ // =============================================================================
96
+ // CONTAINER SIZES
97
+ // =============================================================================
98
+
99
+ pub const CONTAINER_SM: f32 = 640.0;
100
+ pub const CONTAINER_MD: f32 = 900.0;
101
+ pub const CONTAINER_LG: f32 = 1200.0;
102
+ pub const CONTAINER_XL: f32 = 1400.0;
103
+
104
+ /// Get container padding
105
+ pub fn container_padding() -> vec2 {
106
+ vec2(SPACE_6, SPACE_6)
137
107
  }