refactor(render): move RenderBackend trait into op-editor-core

This commit is contained in:
Kayshen-X 2026-05-16 14:36:09 +08:00
parent b67fe5fbcc
commit 0174aba93a
6 changed files with 19 additions and 2 deletions

2
Cargo.lock generated
View file

@ -2278,6 +2278,7 @@ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
name = "op-editor-core"
version = "0.1.0"
dependencies = [
"glam",
"jian-core",
"jian-ops-schema",
]
@ -2319,6 +2320,7 @@ dependencies = [
"bitflags 2.11.1",
"glam",
"jian-core",
"op-editor-core",
"op-i18n",
"serde",
"thiserror 1.0.69",

View file

@ -9,3 +9,7 @@ description = "OpenPencil editor state — selection/tool/history/viewport on ji
[dependencies]
jian-ops-schema = { path = "../../vendor/jian/crates/jian-ops-schema" }
jian-core = { path = "../../vendor/jian/crates/jian-core" }
# render_backend.rs uses glam::Vec2 as Point2D (spec §5.2). Pinned to the
# same version openpencil-shell-core uses so both crates resolve one glam.
glam = { version = "0.29", default-features = false, features = ["std"] }

View file

@ -1 +1,4 @@
//! OpenPencil editor core.
pub mod render_backend;
pub use render_backend::*;

View file

@ -36,6 +36,11 @@ jian-core = { path = "../../vendor/jian/crates/jian-core", version = "0.0.1" }
# resolving `crate::i18n::*` / `crate::document::Locale` unchanged.
op-i18n = { path = "../op-i18n" }
# Phase 4 strangler reorg: the wasm-clean RenderBackend trait moved into
# op-editor-core; shell-core re-exports it as `render_backend` so downstream
# callers keep resolving `crate::render_backend::*` / `crate::RenderBackend`.
op-editor-core = { path = "../op-editor-core" }
[features]
default = []
serde = ["dep:serde"]

View file

@ -28,12 +28,15 @@ pub use op_i18n as i18n;
pub mod jian;
pub mod mcp;
#[cfg(test)] mod mcp_tests;
pub mod render_backend;
// Phase 4 strangler reorg: the wasm-clean RenderBackend trait moved into the
// op-editor-core crate. Re-exported as `render_backend` so `crate::render_backend::*`
// paths still resolve.
pub use op_editor_core::render_backend;
pub mod theme;
pub mod widgets;
// Re-export the primary API for upstream crates / widgets / tests.
pub use render_backend::{Color, Point2D, Rect, RenderBackend, TextLayout};
pub use op_editor_core::render_backend::{Color, Point2D, Rect, RenderBackend, TextLayout};
pub use theme::Theme;
/// Re-exports of Jian gesture / event types so shell consumers can use the