Skip to content

Commit

Permalink
Merge pull request #102 from slowtec/public-dom-patch
Browse files Browse the repository at this point in the history
Make VDOM functions public
  • Loading branch information
ivanceras authored Jan 27, 2025
2 parents 8ec2fe5 + 2b3d604 commit 679b10c
Show file tree
Hide file tree
Showing 12 changed files with 804 additions and 536 deletions.
18 changes: 5 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ with-node-macro = ["sauron-macro"]
html-parser = ["sauron-html-parser"]
use-skipdiff = ["sauron-core/use-skipdiff"]


[dev-dependencies]
console_error_panic_hook = "0.1.7"
console_log = "1.0"
Expand All @@ -62,8 +61,13 @@ features = [
"InputEvent",
"console",
"Performance",
"Element",
"Window",
]

[dev-dependencies.criterion]
version = "0.5.1"
default-features = false

[workspace]
members = [
Expand All @@ -77,18 +81,6 @@ exclude = [
"examples/progressive-rendering",
]



[patch.crates-io]
#mt-dom = { git = "https://github.com/ivanceras/mt-dom.git", branch = "master" }
#mt-dom = { path = "../mt-dom" }
#jss = { git = "https://github.com/ivanceras/jss.git", branch = "master" }
#jss = { path = "../jss" }

[dev-dependencies.criterion]
version = "0.5.1"
default-features = false

[package.metadata.docs.rs]
all-features = true
default-target = "wasm32-unknown-unknown"
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Sauron is inspired by elm-lang and is following The Elm Architecture.
- html syntax for writing views
- elegant macro to write styles
- batteries included
- standalone DOM/VirtualDOM patcher
(see [`examples/patch_dom_node`](https://github.com/ivanceras/sauron/tree/master/examples/patch_dom_node))

### Devoid of unnecessary framework complexities
- **no** framework specific cli needed
Expand Down
44 changes: 23 additions & 21 deletions crates/core/src/dom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,32 @@ mod effects;
use cfg_if::cfg_if;

cfg_if! {if #[cfg(feature = "with-dom")] {
mod application;
mod dom_node;
mod dom_patch;
mod dom_attr;
mod http;
mod program;
mod raf;
mod ric;
mod window;
mod document;
mod time;
mod timeout;

pub mod events;
pub mod dispatch;
pub mod util;

pub use application::{Application, Measurements, SkipDiff, skip_if, skip_diff, SkipPath};
pub use component::{stateful_component, StatefulComponent, StatefulModel, StatelessModel};
pub use component::component;
pub use dom_patch::{DomPatch, PatchVariant};
pub use dispatch::Dispatch;
pub use document::Document;
pub use dom_patch::{DomPatch, PatchVariant, apply_dom_patches, convert_patches};
pub use dom_attr::{DomAttr, DomAttrValue, GroupedDomAttrValues};
pub use dom_node::DomNode;
pub use dom_node::create_dom_node;
pub use http::Http;
pub use program::{MountAction, MountTarget, Program, MountProcedure};
pub use util::{
Expand All @@ -26,29 +47,10 @@ cfg_if! {if #[cfg(feature = "with-dom")] {
pub use raf::{request_animation_frame, AnimationFrameHandle};
pub use ric::{request_idle_callback, IdleCallbackHandle, IdleDeadline};
pub use timeout::{delay, request_timeout_callback, TimeoutCallbackHandle};
pub use dispatch::Dispatch;
use crate::dom::events::MountEvent;
pub use window::Window;
pub use dom_node::DomNode;
pub use document::Document;
pub use time::Time;

mod application;
pub mod dispatch;
mod dom_node;
mod dom_patch;
mod dom_attr;
pub mod events;
mod http;
mod program;
pub mod util;
mod raf;
mod ric;
mod window;
mod document;
mod time;
mod timeout;

use crate::dom::events::MountEvent;

/// Map the Event to DomEvent, which are browser events
#[derive(Debug, Clone)]
Expand Down
Loading

0 comments on commit 679b10c

Please sign in to comment.