Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

raea-sys-page's op wire is a crate of its own, raea-sys-page-ops (systems/page-ops): ops.rs and ops/attrs.rs moved whole, with ALL_DAMAGE, which they mark damage with. raea-sys-page re-exports it as `ops` (and ALL_DAMAGE), so every raea_sys_page::ops path reads as before. raea-sys-page had reached 2000 lines through the day's landings, so a fix in it (PR #35, #37's next) had no room; it's 1424 now. No code changed: the moved tests pass (cargo test -p raea-sys-page-ops) and raea-sys-page checks with its tests.

shinyobjectzfd4d06c4e40f
diff --git a/Cargo.lock b/Cargo.lock
index 5d6edce8..8b17902c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -15360,13 +15360,12 @@ dependencies = [
"parley",
"raea-core-wire",
"raea-gpu-device",
- "raea-sys-canvas",
"raea-sys-filters",
"raea-sys-fonts",
"raea-sys-image",
"raea-sys-page-net",
+ "raea-sys-page-ops",
"serde_json",
- "stylo",
"vello",
"wgpu",
]
@@ -15385,6 +15384,18 @@ dependencies = [
"url",
]
+[[package]]
+name = "raea-sys-page-ops"
+version = "0.1.0"
+dependencies = [
+ "blitz-dom",
+ "raea-core-wire",
+ "raea-sys-canvas",
+ "serde_json",
+ "stylo",
+ "vello",
+]
+
[[package]]
name = "raea-sys-parity"
version = "0.1.0"
diff --git a/Cargo.toml b/Cargo.toml
index 6bba783a..6866a4c8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -90,6 +90,7 @@ members = [
"systems/procmat",
"systems/page",
"systems/page-net",
+ "systems/page-ops",
"systems/frame",
"systems/splat",
"systems/sprite",
diff --git a/systems/page-ops/Cargo.toml b/systems/page-ops/Cargo.toml
new file mode 100644
index 00000000..08a5ded8
--- /dev/null
+++ b/systems/page-ops/Cargo.toml
@@ -0,0 +1,19 @@
+[package]
+name = "raea-sys-page-ops"
+version = "0.1.0"
+edition = "2024"
+license = "FSL-1.1-ALv2"
+publish = false
+description = "raea-runtime-js's wire ops applied to a Blitz document through its mutation API (raea-sys-page's ops)"
+
+[dependencies]
+# its svg fonts, which a canvas draws text with
+blitz-dom = { version = "=0.3.0-beta.4", default-features = false, features = ["svg"] }
+# the op wire
+raea-core-wire = { path = "../../core/wire" }
+serde_json = "1"
+# a canvas element's bitmap, drawn from its display list, and the blob it's held in
+raea-sys-canvas = { path = "../canvas" }
+vello = { version = "=0.11.0", default-features = false }
+# an element's damage when its picture changes (blitz-dom's own type)
+stylo = "=0.22.0"
diff --git a/systems/page/src/ops/attrs.rs b/systems/page-ops/src/attrs.rs
similarity index 100%
rename from systems/page/src/ops/attrs.rs
rename to systems/page-ops/src/attrs.rs
diff --git a/systems/page/src/ops.rs b/systems/page-ops/src/lib.rs
similarity index 98%
rename from systems/page/src/ops.rs
rename to systems/page-ops/src/lib.rs
index 5c967579..8c47e5af 100644
--- a/systems/page/src/ops.rs
+++ b/systems/page-ops/src/lib.rs
@@ -299,7 +299,7 @@ pub fn apply(doc: &mut BaseDocument, nodes: &mut Nodes, ops: Vec<Op>) {
let Some(node) = doc.get_node_mut(n) else { continue };
let at = node.scroll_offset_mut();
if k == "scrollTop" { at.y = v } else { at.x = v }
- node.insert_damage(crate::ALL_DAMAGE);
+ node.insert_damage(ALL_DAMAGE);
node.mark_ancestors_dirty();
if !nodes.scrolled.contains(&id) {
nodes.scrolled.push(id);
@@ -324,7 +324,7 @@ pub fn apply(doc: &mut BaseDocument, nodes: &mut Nodes, ops: Vec<Op>) {
let data = vello::peniko::Blob::new(std::sync::Arc::new(px));
el.special_data = blitz_dom::node::SpecialElementData::Image(Box::new(blitz_dom::node::ImageData::Raster(blitz_dom::node::RasterImageData { width: w, height: h, data })));
node.clear_layout_cache();
- node.insert_damage(crate::ALL_DAMAGE);
+ node.insert_damage(ALL_DAMAGE);
node.mark_ancestors_dirty();
}
}
@@ -430,3 +430,6 @@ pub fn menu_items(d: &BaseDocument, menu: NodeId) -> Vec<NodeId> {
}
out
}
+
+/// Everything about an element made again (blitz-dom's ALL_DAMAGE, crate-private there): what loading an image does.
+pub const ALL_DAMAGE: style::selector_parser::RestyleDamage = style::selector_parser::RestyleDamage::from_bits_retain(0b_0000_0000_1110_1111);
diff --git a/systems/page/Cargo.toml b/systems/page/Cargo.toml
index b2903e1d..f7201ccc 100644
--- a/systems/page/Cargo.toml
+++ b/systems/page/Cargo.toml
@@ -19,9 +19,8 @@ blitz-traits = "=0.3.0-beta.4"
blitz-paint = { version = "=0.3.0-beta.4", default-features = false, features = ["svg", "apple-font-embolden", "custom-widget"] }
vello = { version = "=0.11.0", default-features = false, features = ["wgpu"] }
wgpu = "=30.0.1"
-# a canvas element's bitmap, drawn from its display list
-raea-sys-canvas = { path = "../canvas" }
-# the op wire (ops.rs)
+# the op wire, applied (ops)
+raea-sys-page-ops = { path = "../page-ops" }
raea-core-wire = { path = "../../core/wire" }
# a page's loads (net)
raea-sys-page-net = { path = "../page-net" }
@@ -34,8 +33,6 @@ serde_json = "1"
parley = { version = "=0.12.0", default-features = false, features = ["std"] }
# an iframe's HTML parsed by Blitz
blitz-html = "=0.3.0-beta.4"
-# an element's damage when its picture changes (blitz-dom's own type)
-stylo = "=0.22.0"
[dev-dependencies]
# a custom widget's scene, in widgets.rs's test
diff --git a/systems/page/src/lib.rs b/systems/page/src/lib.rs
index 618188c4..375c4d7f 100644
--- a/systems/page/src/lib.rs
+++ b/systems/page/src/lib.rs
@@ -25,7 +25,7 @@ pub use blitz_dom::not_applied; // what the page asked for and didn't get, said
pub mod providers;
pub mod widgets;
pub use providers::{PageFonts, PageHtmlParser, PageNavigation, PageNet};
-pub mod ops;
+pub use raea_sys_page_ops as ops;
pub mod view3d;
pub use draw::{Placed, view, view_at};
@@ -299,8 +299,7 @@ pub fn iframes() -> bool {
std::env::var_os("RAEA_PAGE_IFRAMES").is_none_or(|v| v != "0")
}
-/// Everything about an element made again (blitz-dom's ALL_DAMAGE, crate-private there): what loading an image does.
-pub const ALL_DAMAGE: style::selector_parser::RestyleDamage = style::selector_parser::RestyleDamage::from_bits_retain(0b_0000_0000_1110_1111);
+pub use ops::ALL_DAMAGE;
/// A document for a page `w` x `h` on its own entity: html, head and a body with no margin and no background (the
/// page is drawn over 3D and video), which is the root the composition's elements go in. (host.rs opens a root's so.)
diff --git a/tools/layers.toml b/tools/layers.toml
index 531f8781..63cecf10 100644
--- a/tools/layers.toml
+++ b/tools/layers.toml
@@ -84,6 +84,7 @@ raea-sys-procmat = "systems"
raea-sys-grass = "systems"
raea-sys-page = "systems"
raea-sys-page-net = "systems"
+raea-sys-page-ops = "systems"
raea-sys-frame = "systems"
raea-sys-splat = "systems"
raea-sys-sprite = "systems"
@@ -198,5 +199,7 @@ raea-sys-filters = true
raea-sys-page = true
# a page's loads (raea-sys-page's net)
raea-sys-page-net = true
+# the op wire applied to a page (raea-sys-page's ops)
+raea-sys-page-ops = true
raea-sys-fonts = true
raea-sys-image = true