-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from azriel91/feature/support-additional-css
- Loading branch information
Showing
13 changed files
with
374 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ members = [ | |
] | ||
|
||
[workspace.package] | ||
version = "0.1.1" | ||
version = "0.2.0" | ||
authors = ["Azriel Hoh <[email protected]>"] | ||
edition = "2021" | ||
homepage = "https://github.com/azriel91/dot_ix" | ||
|
@@ -46,10 +46,10 @@ license = "MIT OR Apache-2.0" | |
|
||
[workspace.dependencies] | ||
# dot_ix crates | ||
dot_ix_model = { version = "0.1.1", path = "crate/model" } | ||
dot_ix_rt = { version = "0.1.1", path = "crate/rt" } | ||
dot_ix_static_check_macros = { version = "0.1.1", path = "crate/static_check_macros" } | ||
dot_ix_web_components = { version = "0.1.1", path = "crate/web_components" } | ||
dot_ix_model = { version = "0.2.0", path = "crate/model" } | ||
dot_ix_rt = { version = "0.2.0", path = "crate/rt" } | ||
dot_ix_static_check_macros = { version = "0.2.0", path = "crate/static_check_macros" } | ||
dot_ix_web_components = { version = "0.2.0", path = "crate/web_components" } | ||
|
||
# external crates | ||
axum = "0.7.4" | ||
|
@@ -66,7 +66,7 @@ leptos_meta = { version = "0.6" } | |
leptos_router = { version = "0.6" } | ||
log = "0.4" | ||
log4rs = { version = "1.3.0", default-features = false } | ||
serde = "1.0.196" | ||
serde = "1.0.197" | ||
tempfile = "3.10.0" | ||
tokio = "1.36.0" | ||
tower = "0.4.13" | ||
|
@@ -77,5 +77,5 @@ tracing = "0.1.40" | |
http = "1.0.0" | ||
proc-macro2 = "1.0.78" | ||
quote = "1.0.35" | ||
syn = "2.0.49" | ||
serde_yaml = "0.9.31" | ||
syn = "2.0.50" | ||
serde_yaml = "0.9.32" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
/// The style of graph to render. | ||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] | ||
pub enum GraphStyle { | ||
/// A rectangle is rendered for each node, with labels within them. | ||
#[default] | ||
Boxes, | ||
/// A circle is rendered for each node, with labels next to them. | ||
Circle, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,82 @@ | ||
use indexmap::{IndexMap, IndexSet}; | ||
pub use indexmap::{IndexMap, IndexSet}; | ||
|
||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::common::{EdgeId, NodeHierarchy, NodeId, TagId, TailwindClasses}; | ||
|
||
pub use self::{graph_dir::GraphDir, node_info::NodeInfo, tag::Tag}; | ||
pub use self::{ | ||
graph_dir::GraphDir, info_graph_builder::InfoGraphBuilder, node_info::NodeInfo, tag::Tag, | ||
}; | ||
|
||
mod graph_dir; | ||
mod info_graph_builder; | ||
mod node_info; | ||
mod tag; | ||
|
||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] | ||
#[serde(default)] | ||
pub struct InfoGraph { | ||
/// Direction of the graph, `vertical` or `horizontal`. | ||
direction: GraphDir, | ||
pub(crate) direction: GraphDir, | ||
/// Nested nodes. | ||
hierarchy: NodeHierarchy, | ||
pub(crate) hierarchy: NodeHierarchy, | ||
/// Logical / ordering dependencies. | ||
edges: IndexMap<EdgeId, [NodeId; 2]>, | ||
pub(crate) edges: IndexMap<EdgeId, [NodeId; 2]>, | ||
/// List of nodes and basic node info. | ||
node_infos: IndexMap<NodeId, NodeInfo>, | ||
pub(crate) node_infos: IndexMap<NodeId, NodeInfo>, | ||
/// Tags associated with each node. | ||
node_tags: IndexMap<NodeId, IndexSet<TagId>>, | ||
pub(crate) node_tags: IndexMap<NodeId, IndexSet<TagId>>, | ||
/// Tags to associate with nodes. | ||
tags: IndexMap<TagId, Tag>, | ||
pub(crate) tags: IndexMap<TagId, Tag>, | ||
/// Tailwind classes to add to nodes with the given tag. | ||
tailwind_classes: TailwindClasses, | ||
pub(crate) tailwind_classes: TailwindClasses, | ||
/// Additional CSS to add in the spreadsheet. | ||
pub(crate) css: String, | ||
} | ||
|
||
impl InfoGraph { | ||
/// Returns a builder to instantiate an `InfoGraph`. | ||
pub fn builder() -> InfoGraphBuilder { | ||
InfoGraphBuilder::default() | ||
} | ||
|
||
/// Returns the direction of the graph, `vertical` or `horizontal`. | ||
pub fn direction(&self) -> GraphDir { | ||
self.direction | ||
} | ||
|
||
/// Returns the nested nodes. | ||
pub fn hierarchy(&self) -> &NodeHierarchy { | ||
&self.hierarchy | ||
} | ||
|
||
/// Returns the logical / ordering dependencies. | ||
pub fn edges(&self) -> &IndexMap<EdgeId, [NodeId; 2]> { | ||
&self.edges | ||
} | ||
|
||
/// Returns the list of nodes and basic node info. | ||
pub fn node_infos(&self) -> &IndexMap<NodeId, NodeInfo> { | ||
&self.node_infos | ||
} | ||
|
||
/// Returns the tags associated with each node. | ||
pub fn node_tags(&self) -> &IndexMap<NodeId, IndexSet<TagId>> { | ||
&self.node_tags | ||
} | ||
|
||
/// Returns the tags to associate with nodes. | ||
pub fn tags(&self) -> &IndexMap<TagId, Tag> { | ||
&self.tags | ||
} | ||
|
||
/// Returns the tailwind classes to add to nodes with the given tag. | ||
pub fn tailwind_classes(&self) -> &TailwindClasses { | ||
&self.tailwind_classes | ||
} | ||
|
||
/// Returns the additional CSS to add in the spreadsheet. | ||
pub fn css(&self) -> &str { | ||
&self.css | ||
} | ||
} |
Oops, something went wrong.