Skip to content

Commit

Permalink
Merge pull request #30 from azriel91/feature/more-examples
Browse files Browse the repository at this point in the history
  • Loading branch information
azriel91 authored Aug 7, 2024
2 parents 8ecdac1 + 7540e04 commit ef71c61
Show file tree
Hide file tree
Showing 24 changed files with 1,394 additions and 584 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Add `ThemeAttr::Visibility` to support setting [`visibility`].
* Fix black outline shown on focused nodes in Chrome / Edge.
* Show feedback to user when stroke / outline / fill class partials are not all specified.
* Add examples to playground.

[monaco]: https://github.com/microsoft/monaco-editor
[rust-monaco]: https://github.com/siku2/rust-monaco
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ axum = "0.7.5"
console_error_panic_hook = "0.1"
console_log = "1"
cfg-if = "1"
gloo-net = "0.6.0"
indexmap = "2.2.6"
indoc = "2.0.5"
js-sys = "0.3.69"
Expand All @@ -89,6 +90,7 @@ tracing = "0.1.40"
http = "1.1.0"
proc-macro2 = "1.0.85"
quote = "1.0.36"
reqwest = "0.12.5"
syn = "2.0.66"
serde_yaml = "0.9.34"

Expand Down
2 changes: 1 addition & 1 deletion crate/model/src/common/graphviz_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl Default for GraphvizAttrs {
edge_constraints: EdgeConstraints::default(),
edge_dir_default: EdgeDir::default(),
edge_dirs: EdgeDirs::default(),
edge_minlen_default: 1,
edge_minlen_default: 2,
edge_minlens: EdgeMinlens::default(),
pack_mode: PackMode::default(),
}
Expand Down
33 changes: 18 additions & 15 deletions crate/model/src/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub use self::{
css_class_merger::CssClassMerger, css_class_partials::CssClassPartials,
css_classes::CssClasses, css_classes_and_warnings::CssClassesAndWarnings,
css_classes_builder::CssClassesBuilder, el_css_classes::ElCssClasses,
highlight_state::HighlightState, stroke_params::StrokeParams, style_for::StyleFor,
highlight_state::HighlightState, line_params::LineParams, style_for::StyleFor,
theme_attr::ThemeAttr, theme_styles::ThemeStyles, theme_warnings::ThemeWarnings,
themeable::Themeable,
};
Expand All @@ -26,7 +26,7 @@ mod css_classes_and_warnings;
mod css_classes_builder;
mod el_css_classes;
mod highlight_state;
mod stroke_params;
mod line_params;
mod style_for;
mod theme_attr;
mod theme_styles;
Expand Down Expand Up @@ -168,7 +168,6 @@ impl Theme {

node_defaults
});
let mut theme = Self::default();

theme.insert(AnyIdOrDefaults::EdgeDefaults, {
let mut edge_defaults = CssClassPartials::new();
Expand Down Expand Up @@ -274,17 +273,18 @@ impl Theme {
T: Themeable,
{
let node_class_partials_defaults = self.get(&AnyIdOrDefaults::NodeDefaults);
themeable.node_ids().filter_map(move |node_id| {
themeable.node_ids().map(move |node_id| {
let node_class_partials_specified = self.node_class_partials_specified(node_id);

let any_id = Some(AnyId::from(node_id.clone()));
let any_id = AnyId::from(node_id.clone());
let node_classes_and_warnings = CssClassMerger::node_classes(
&any_id,
node_class_partials_defaults,
node_class_partials_specified,
themeable,
);

any_id.map(|any_id| (any_id, node_classes_and_warnings))
(any_id, node_classes_and_warnings)
})
}

Expand All @@ -307,17 +307,18 @@ impl Theme {
{
let edge_class_partials_defaults = self.get(&AnyIdOrDefaults::EdgeDefaults);

themeable.edge_ids().filter_map(move |edge_id| {
themeable.edge_ids().map(move |edge_id| {
let edge_class_partials_specified = self.edge_class_partials_specified(edge_id);

let any_id = Some(AnyId::from(edge_id.clone()));
let any_id = AnyId::from(edge_id.clone());
let edge_classes_and_warnings = CssClassMerger::edge_classes(
&any_id,
edge_class_partials_defaults,
edge_class_partials_specified,
themeable,
);

any_id.map(|any_id| (any_id, edge_classes_and_warnings))
(any_id, edge_classes_and_warnings)
})
}

Expand Down Expand Up @@ -393,18 +394,19 @@ impl Theme {
T: Themeable,
{
let node_class_partials_defaults = self.get(&AnyIdOrDefaults::NodeDefaults);
themeable.node_ids().filter_map(move |node_id| {
themeable.node_ids().map(move |node_id| {
let node_class_partials_specified = self.node_class_partials_specified(node_id);

let any_id = Some(AnyId::from(node_id.clone()));
let any_id = AnyId::from(node_id.clone());
let node_classes_and_warnings = CssClassMerger::node_tag_classes(
&any_id,
node_class_partials_defaults,
node_class_partials_specified,
themeable,
tag_id,
);

any_id.map(|any_id| (any_id, node_classes_and_warnings))
(any_id, node_classes_and_warnings)
})
}

Expand All @@ -418,18 +420,19 @@ impl Theme {
{
let edge_class_partials_defaults = self.get(&AnyIdOrDefaults::EdgeDefaults);

themeable.edge_ids().filter_map(move |edge_id| {
themeable.edge_ids().map(move |edge_id| {
let edge_class_partials_specified = self.edge_class_partials_specified(edge_id);

let any_id = Some(AnyId::from(edge_id.clone()));
let any_id = AnyId::from(edge_id.clone());
let edge_classes_and_warnings = CssClassMerger::edge_tag_classes(
&any_id,
edge_class_partials_defaults,
edge_class_partials_specified,
themeable,
tag_id,
);

any_id.map(|any_id| (any_id, edge_classes_and_warnings))
(any_id, edge_classes_and_warnings)
})
}
}
Expand Down
Loading

0 comments on commit ef71c61

Please sign in to comment.