diff --git a/crates/op-codegen/Cargo.toml b/crates/op-codegen/Cargo.toml new file mode 100644 index 000000000..930da3489 --- /dev/null +++ b/crates/op-codegen/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "op-codegen" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +description = "OpenPencil code generators — emit HTML/Vue/Svelte/React/Flutter/SwiftUI/Compose/RN from a PenDocument" + +[lib] +name = "op_codegen" +path = "src/lib.rs" + +[dependencies] +jian-ops-schema = { path = "../../vendor/jian/crates/jian-ops-schema" } +op-editor-core = { path = "../op-editor-core" } diff --git a/crates/openpencil-shell-core/src/codegen_targets.rs b/crates/op-codegen/src/codegen_targets.rs similarity index 98% rename from crates/openpencil-shell-core/src/codegen_targets.rs rename to crates/op-codegen/src/codegen_targets.rs index 727021842..489caf9de 100644 --- a/crates/openpencil-shell-core/src/codegen_targets.rs +++ b/crates/op-codegen/src/codegen_targets.rs @@ -1,13 +1,13 @@ //! Per-framework markup generators — the React / Vue / Svelte / HTML //! / Flutter / SwiftUI / Compose / React Native targets carved off -//! `codegen.rs` to keep both files under the 800-line cap. +//! `lib.rs` to keep both files under the 800-line cap. //! //! All generators consume the canonical `jian_ops_schema::PenDocument` -//! and walk `PenNode` through the flat-view accessors in the parent -//! `codegen` module (`node_origin` / `node_size` / `node_fill_css` / +//! and walk `PenNode` through the flat-view accessors in the crate +//! root (`node_origin` / `node_size` / `node_fill_css` / //! …) so the per-target emit logic stays variant-agnostic. -use crate::codegen::{ +use crate::{ color_to_css, fmt_num, html_escape, node_children, node_corner_radius, node_fill_css, node_hidden, node_is_ellipse, node_is_text, node_origin, node_rotation_deg, node_size, node_stroke_css, node_text, parse_color, root_nodes, Codegen, CssVariables, diff --git a/crates/openpencil-shell-core/src/codegen.rs b/crates/op-codegen/src/lib.rs similarity index 99% rename from crates/openpencil-shell-core/src/codegen.rs rename to crates/op-codegen/src/lib.rs index 1a0aa7f1e..2cfff42f4 100644 --- a/crates/openpencil-shell-core/src/codegen.rs +++ b/crates/op-codegen/src/lib.rs @@ -12,6 +12,8 @@ //! node-accessor helpers, and the test suite; per-framework markup //! generators live in the sibling `codegen_targets` module. +mod codegen_targets; + pub use crate::codegen_targets::{ Compose, Flutter, Html, React, ReactNative, Svelte, SwiftUi, Vue, }; diff --git a/crates/openpencil-shell-core/src/lib.rs b/crates/openpencil-shell-core/src/lib.rs index eaa5fd35f..16c99ed1e 100644 --- a/crates/openpencil-shell-core/src/lib.rs +++ b/crates/openpencil-shell-core/src/lib.rs @@ -19,8 +19,6 @@ pub mod agent_settings_state; pub mod chat_models; pub mod chat_provider; -pub mod codegen; -mod codegen_targets; pub mod figma; // Phase 3 strangler reorg: i18n extracted into the op-i18n crate. Re-exported // as `i18n` so `crate::i18n::translate` / `crate::i18n::Locale` paths still resolve.