summaryrefslogtreecommitdiff
path: root/src/types/mod.rs
diff options
context:
space:
mode:
authorpml68 <contact@pml68.me>2024-09-03 21:55:34 +0200
committerpml68 <contact@pml68.me>2024-09-22 23:55:11 +0200
commite8792ea151e0c26fd3497a09446f1b846df1c87c (patch)
tree3aed2ad399ae78fd6ead35c3d71906f0dbe31b71 /src/types/mod.rs
parentfeat: format children nodes into code (without props) (diff)
downloadiced-builder-e8792ea151e0c26fd3497a09446f1b846df1c87c.tar.gz
feat: finish codegen for elements **without** props
feat: wow
Diffstat (limited to 'src/types/mod.rs')
-rw-r--r--src/types/mod.rs34
1 files changed, 6 insertions, 28 deletions
diff --git a/src/types/mod.rs b/src/types/mod.rs
index 09b0f07..60b28f7 100644
--- a/src/types/mod.rs
+++ b/src/types/mod.rs
@@ -1,24 +1,17 @@
-use std::path::PathBuf;
+pub mod props;
+pub mod rendered_element;
-use iced::{
- alignment::{Horizontal, Vertical},
- widget::{text::Shaping, text_editor},
- Alignment, ContentFit, Font, Length,
-};
+use iced::widget::text_editor;
+use rendered_element::RenderedElement;
+use std::path::PathBuf;
pub struct DesignerState {
pub designer_content: Vec<RenderedElement>,
pub designer_page: DesignerPage,
}
-pub struct RenderedElement {
- pub id: String,
- pub children: Option<Vec<RenderedElement>>,
- pub name: ElementName,
- pub props: Props,
-}
-
pub enum ElementName {
+ App(String, iced::Theme),
Text(String),
Button(String),
TextEditor(text_editor::Content),
@@ -29,21 +22,6 @@ pub enum ElementName {
Column,
}
-pub struct Props {
- pub align_items: Option<Alignment>,
- pub align_x: Option<Horizontal>,
- pub align_y: Option<Vertical>,
- pub horizontal_alignment: Option<Horizontal>,
- pub vertical_alignment: Option<Vertical>,
- pub height: Option<Length>,
- pub width: Option<Length>,
- pub font: Option<Font>,
- pub padding: Option<i32>,
- pub spacing: Option<i32>,
- pub content_fit: Option<ContentFit>,
- pub shaping: Option<Shaping>,
-}
-
pub enum DesignerPage {
Designer,
CodeView,