diff --git a/Cargo.lock b/Cargo.lock index 4cf2cd8..88dc10e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1174,6 +1174,7 @@ name = "deckcraft-web" version = "0.7.0" dependencies = [ "deckcraft-engine", + "deckcraft-fonts", "deckcraft-ui-egui", "eframe", "egui", diff --git a/apps/deckcraft-web/Cargo.toml b/apps/deckcraft-web/Cargo.toml index 7014421..4ecab5f 100644 --- a/apps/deckcraft-web/Cargo.toml +++ b/apps/deckcraft-web/Cargo.toml @@ -15,6 +15,8 @@ path = "src/main.rs" [dependencies] deckcraft-engine = { workspace = true } +# Modified by XenLook (XenSlide, 2026-11-17): the site's Nanum fonts join the font database. +deckcraft-fonts = { workspace = true } deckcraft-ui-egui = { workspace = true } egui = { workspace = true } log = { workspace = true } @@ -27,4 +29,4 @@ rfd = { workspace = true } wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" js-sys = "0.3" -web-sys = { version = "0.3", features = ["Window", "Document", "Element", "HtmlElement", "HtmlCanvasElement", "HtmlAnchorElement", "Blob", "BlobPropertyBag", "Url", "Location", "CssStyleDeclaration"] } +web-sys = { version = "0.3", features = ["Window", "Document", "Element", "HtmlElement", "HtmlCanvasElement", "HtmlAnchorElement", "Blob", "BlobPropertyBag", "Url", "Location", "Navigator", "CssStyleDeclaration", "Response"] } diff --git a/apps/deckcraft-web/src/api.rs b/apps/deckcraft-web/src/api.rs new file mode 100644 index 0000000..55e22b1 --- /dev/null +++ b/apps/deckcraft-web/src/api.rs @@ -0,0 +1,118 @@ +// Added by XenLook (2026-11-18): the page's control channel, so the XenOffice agent panel edits the open document. +//! `window.deckcraft`: the control channel for the page, as promises. +//! +//! The same JSON methods as the desktop control server, so an agent driving XenSlide in a +//! browser tab (the XenOffice AI panel) uses the same commands as the CLI and the MCP server: +//! +//! ```js +//! await deckcraft.execute("slide.new", {title: "Plan"}) // engine command → its result +//! await deckcraft.request("ui.inspect") // control method → its result +//! await deckcraft.commands() // command list +//! ``` +//! +//! Results resolve with the method's `result`; errors reject with an `Error`. + +use std::cell::RefCell; +use std::sync::mpsc::{Receiver, Sender, TryRecvError}; + +use deckcraft_ui_egui::ControlRequest; +use serde_json::{Value, json}; +use wasm_bindgen::prelude::*; + +type Waiting = (Receiver, js_sys::Function, js_sys::Function); + +thread_local! { + static TX: RefCell>> = const { RefCell::new(None) }; + static WAITING: RefCell> = const { RefCell::new(Vec::new()) }; + static CTX: RefCell> = const { RefCell::new(None) }; +} + +/// Wire the page's requests to the app's control queue. +pub fn connect(tx: Sender, ctx: egui::Context) { + TX.with(|t| *t.borrow_mut() = Some(tx)); + CTX.with(|c| *c.borrow_mut() = Some(ctx)); +} + +fn repaint() { + CTX.with(|c| { + if let Some(ctx) = c.borrow().as_ref() { + ctx.request_repaint(); + } + }); +} + +fn to_js(v: &Value) -> JsValue { + js_sys::JSON::parse(&v.to_string()).unwrap_or(JsValue::NULL) +} + +fn from_js(v: &JsValue) -> Value { + if v.is_undefined() || v.is_null() { + return json!({}); + } + js_sys::JSON::stringify(v).ok().and_then(|s| s.as_string()).and_then(|s| serde_json::from_str(&s).ok()).unwrap_or(json!({})) +} + +/// Settle the promises of answered requests (called every frame). +pub fn poll_replies() { + WAITING.with(|w| { + w.borrow_mut().retain(|(rx, resolve, reject)| match rx.try_recv() { + Ok(v) => { + if v.get("ok").and_then(Value::as_bool) == Some(true) { + let _ = resolve.call1(&JsValue::NULL, &to_js(v.get("result").unwrap_or(&Value::Null))); + } else { + let msg = v.get("error").and_then(Value::as_str).unwrap_or("error").to_string(); + let _ = reject.call1(&JsValue::NULL, &js_sys::Error::new(&msg)); + } + false + } + Err(TryRecvError::Empty) => true, + Err(TryRecvError::Disconnected) => { + let _ = reject.call1(&JsValue::NULL, &js_sys::Error::new("request dropped")); + false + } + }); + }); +} + +fn request(method: &str, params: Value) -> js_sys::Promise { + let method = method.to_string(); + let p = js_sys::Promise::new(&mut |resolve, reject| { + let (req, rx) = ControlRequest::new(method.clone(), params.clone()); + let sent = TX.with(|t| t.borrow().as_ref().is_some_and(|tx| tx.send(req).is_ok())); + if sent { + WAITING.with(|w| w.borrow_mut().push((rx, resolve, reject))); + } else { + let _ = reject.call1(&JsValue::NULL, &js_sys::Error::new("XenSlide is not running yet")); + } + }); + repaint(); + p +} + +fn set_fn(obj: &js_sys::Object, name: &str, f: JsValue) -> Result<(), JsValue> { + js_sys::Reflect::set(obj, &name.into(), &f).map(|_| ()) +} + +/// Install `window.deckcraft`. +pub fn install() -> Result<(), JsValue> { + let obj = js_sys::Object::new(); + set_fn( + &obj, + "request", + Closure:: js_sys::Promise>::new(|method: String, params: JsValue| request(&method, from_js(¶ms))) + .into_js_value(), + )?; + set_fn( + &obj, + "execute", + Closure:: js_sys::Promise>::new(|command: String, params: JsValue| { + request("engine.execute", json!({"command": command, "params": from_js(¶ms)})) + }) + .into_js_value(), + )?; + set_fn(&obj, "commands", Closure:: js_sys::Promise>::new(|| request("engine.commands", json!({}))).into_js_value())?; + set_fn(&obj, "inspect", Closure:: js_sys::Promise>::new(|| request("ui.inspect", json!({}))).into_js_value())?; + let w = web_sys::window().ok_or("no window")?; + js_sys::Reflect::set(&w, &"deckcraft".into(), &obj)?; + Ok(()) +} diff --git a/apps/deckcraft-web/src/main.rs b/apps/deckcraft-web/src/main.rs index 366ea34..59904d2 100644 --- a/apps/deckcraft-web/src/main.rs +++ b/apps/deckcraft-web/src/main.rs @@ -17,6 +17,10 @@ #![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] #![forbid(unsafe_code)] +#[cfg(target_arch = "wasm32")] +mod api; +#[cfg(target_arch = "wasm32")] +mod site_fonts; #[cfg(target_arch = "wasm32")] mod web; diff --git a/apps/deckcraft-web/src/web.rs b/apps/deckcraft-web/src/web.rs index f0199a5..13565d5 100644 --- a/apps/deckcraft-web/src/web.rs +++ b/apps/deckcraft-web/src/web.rs @@ -4,7 +4,7 @@ use deckcraft_engine::Session; use deckcraft_ui_egui::{Inbox, Services, SlideApp}; use wasm_bindgen::JsCast as _; -const PRESENTATION_EXTS: &[&str] = &["deckcraft", "pptx", "potx", "ppsx", "txt", "md"]; +const PRESENTATION_EXTS: &[&str] = &["xenslide", "deckcraft", "pptx", "potx", "ppsx", "txt", "md"]; const PICTURE_EXTS: &[&str] = &["png", "jpg", "jpeg", "gif", "webp", "bmp", "tif", "tiff"]; const AUDIO_EXTS: &[&str] = &["wav", "mp3", "m4a", "aac", "flac", "ogg", "opus", "aif", "aiff"]; const VIDEO_EXTS: &[&str] = &["mp4", "m4v", "mov", "webm"]; @@ -36,8 +36,39 @@ pub fn start() { if let Some(rs) = &cc.wgpu_render_state { log::info!("deckcraft-web {}: wgpu backend {:?}", env!("CARGO_PKG_VERSION"), rs.adapter.get_info().backend); } + // Modified by XenLook (XenSlide, 2026-11-17): the Nanum family the site serves (OFL-1.1). + crate::site_fonts::load_all(cc.egui_ctx.clone()); let inbox: Inbox = Inbox::default(); + // Modified by XenLook (XenSlide, 2026-10-16; ja/zh 2026-11-17): the interface language from + // `?lang=` (XenLook's interface language) or, without it, the browser's. + deckcraft_ui_egui::xenlook_brand::set_lang(wanted_lang()); let mut app = SlideApp::new(Session::new(), services(inbox.clone(), cc.egui_ctx.clone())); + // Added by XenLook (2026-11-18): `window.deckcraft`, the control channel the agent panel drives. + let (control_tx, control_rx) = std::sync::mpsc::channel(); + app = app.with_control(control_rx); + crate::api::connect(control_tx, cc.egui_ctx.clone()); + if let Err(e) = crate::api::install() { + log::warn!("window.deckcraft: {e:?}"); + } + // Modified by XenLook (XenSlide, 2026-11-01): a phone held sideways or a flip phone's + // cover screen starts with the ribbon folded, so the slide keeps most of the height; a narrow + // phone starts with a narrow slide list (an open foldable or a small tablet with a medium + // one); a page without its own close button gets no empty slot for one. + if let Some(win) = web_sys::window() { + let w = win.inner_width().ok().and_then(|v| v.as_f64()).unwrap_or(1200.0); + let h = win.inner_height().ok().and_then(|v| v.as_f64()).unwrap_or(800.0); + if h < 540.0 { + app.ui.ribbon_collapsed = true; + } + // Modified by XenLook (XenSlide, 2026-11-19): the slide list width follows the window + // (17 %, 150–236 px; see `thumbs::auto_width`) whenever it changes — the agent panel + // docking narrows the editor after start — until the person drags the list edge. + app.ui.thumbs_width = deckcraft_ui_egui::thumbs::auto_width(w as f32); + app.ui.thumbs_follow_window = true; + if win.document().and_then(|d| d.get_element_by_id("xl-close")).is_none() { + deckcraft_ui_egui::ribbon::XL_CLOSE_BUTTON.store(false, std::sync::atomic::Ordering::Relaxed); + } + } let q = query(); if !q.contains("blank") { if let Err(e) = deckcraft_engine::sample::open_sample(&mut app.session) { @@ -56,12 +87,31 @@ pub fn start() { if let Some(el) = document.get_element_by_id(LOADING_ID) { match result { Ok(()) => el.remove(), - Err(e) => el.set_inner_html(&format!("

DeckCraft failed to start: {e:?}

A browser with WebGPU or WebGL2 is required.

")), + Err(e) => { + // Modified by XenLook (XenSlide, 2026-11-17): the start-failure notice in the interface language. + use deckcraft_ui_egui::xenlook_brand::Lang; + let (head, need) = match wanted_lang() { + Lang::Ko => ("XenSlide를 시작하지 못했습니다", "WebGPU 또는 WebGL2를 지원하는 브라우저가 필요합니다."), + Lang::Ja => ("XenSlide を起動できませんでした", "WebGPU または WebGL2 に対応したブラウザーが必要です。"), + Lang::Zh => ("XenSlide 无法启动", "需要支持 WebGPU 或 WebGL2 的浏览器。"), + _ => ("XenSlide failed to start", "A browser with WebGPU or WebGL2 is required."), + }; + el.set_inner_html(&format!("

{head}: {e:?}

{need}

")); + } } } }); } +fn wanted_lang() -> deckcraft_ui_egui::xenlook_brand::Lang { + use deckcraft_ui_egui::xenlook_brand::Lang; + let q = query(); + if let Some(v) = q.trim_start_matches('?').split('&').find_map(|kv| kv.strip_prefix("lang=")) { + return Lang::from_tag(v); + } + web_sys::window().and_then(|w| w.navigator().language()).map(|l| Lang::from_tag(&l)).unwrap_or(Lang::En) +} + fn query() -> String { web_sys::window().and_then(|w| w.location().search().ok()).unwrap_or_default() } @@ -75,6 +125,7 @@ struct WebShell { impl eframe::App for WebShell { fn logic(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { + crate::api::poll_replies(); let dropped = ctx.input_mut(|i| std::mem::take(&mut i.raw.dropped_files)); for f in dropped { let inbox = self.inbox.clone(); @@ -139,7 +190,7 @@ fn services(inbox: Inbox, ctx: egui::Context) -> Services { /// Trigger a browser download of `bytes` named after the last component of `path`. fn download(path: &str, bytes: &[u8]) -> Result<(), String> { let js = |e: wasm_bindgen::JsValue| format!("{e:?}"); - let name = std::path::Path::new(path).file_name().map(|n| n.to_string_lossy().to_string()).unwrap_or_else(|| "deckcraft".into()); + let name = std::path::Path::new(path).file_name().map(|n| n.to_string_lossy().to_string()).unwrap_or_else(|| "presentation.xenslide".into()); let window = web_sys::window().ok_or("no window")?; let document = window.document().ok_or("no document")?; let parts = js_sys::Array::of1(&js_sys::Uint8Array::from(bytes)); @@ -170,7 +221,7 @@ fn mime_for(name: &str) -> &'static str { Some("pdf") => "application/pdf", Some("txt") => "text/plain", Some("pptx") => "application/vnd.openxmlformats-officedocument.presentationml.presentation", - Some("deckcraft") => "application/zip", + Some("xenslide" | "deckcraft") => "application/zip", _ => "application/octet-stream", } } diff --git a/crates/engine/src/cmd/file.rs b/crates/engine/src/cmd/file.rs index f6424f7..19f5561 100644 --- a/crates/engine/src/cmd/file.rs +++ b/crates/engine/src/cmd/file.rs @@ -83,7 +83,7 @@ pub fn open_presentation(name: &str, bytes: &[u8]) -> Result { } return Ok(p); } - Err(EngineError::Other(format!("{name}: not a presentation DeckCraft can read"))) + Err(EngineError::Other(format!("{name}: not a presentation XenSlide can read"))) } pub fn add_opened(s: &mut Session, name: &str, path: Option, p: Presentation) -> usize { diff --git a/crates/engine/src/cmd/insert.rs b/crates/engine/src/cmd/insert.rs index 2643ab1..15891aa 100644 --- a/crates/engine/src/cmd/insert.rs +++ b/crates/engine/src/cmd/insert.rs @@ -4,7 +4,7 @@ use deckcraft_color::SchemeSlot; use deckcraft_geom::Xfrm; use deckcraft_model::chart::ChartType; use deckcraft_model::style::PictureFill; -use deckcraft_model::text::{AutoFit, RunKind, TextBody}; +use deckcraft_model::text::{Anchor, AutoFit, RunKind, TextBody}; use deckcraft_model::{Chart, ColorRef, Fill, Geom, MediaClip, Shape, ShapeId, ShapeKind, ShapeStyle, Table}; use serde_json::{Value, json}; @@ -23,7 +23,7 @@ pub fn specs() -> Vec { insert_shape ), cmd!(query "shape.presets", "Shape Gallery", [], None, "{} → [{name, label, category}]", always, presets), - cmd!("insert.textBox", "Text Box", ["Insert", "Text"], None, "{rect?: [x,y,w,h], text?: string}", has_slide, text_box), + cmd!("insert.textBox", "Text Box", ["Insert", "Text"], None, "{rect?: [x,y,w,h], text?: string, anchor?: top|middle|bottom, autofit?: resize|shrink|none}", has_slide, text_box), cmd!( "insert.picture", "Picture from File…", @@ -131,6 +131,8 @@ pub(crate) fn add_shape(s: &mut Session, mut shape: Shape, select: bool) -> Resu if select { sel.shapes = vec![id]; sel.text = None; + // A new shape replaces any table-cell selection (it may belong to another slide). + sel.cells = None; } Ok(id) }) @@ -204,6 +206,28 @@ fn text_box(s: &mut Session, p: &Value) -> Result { t.body.wrap = Some(false); } } + // Vertical anchor and autofit up front: a box that resizes to its text has no room to + // centre in, so a middle/bottom anchor without an explicit autofit keeps the given height. + let anchor = str_param(p, "anchor").map(|a| match a { + "middle" | "center" | "ctr" => Anchor::Middle, + "bottom" | "b" => Anchor::Bottom, + _ => Anchor::Top, + }); + let fit = match str_param(p, "autofit") { + Some("resize" | "shape") => Some(AutoFit::Shape), + Some("shrink") => Some(AutoFit::Shrink { font_scale: 1.0, line_reduction: 0.0 }), + Some(_) => Some(AutoFit::None), + None if anchor.is_some_and(|a| a != Anchor::Top) && rect.w >= 1.0 => Some(AutoFit::None), + None => None, + }; + if let Some(t) = shape.text.as_mut() { + if anchor.is_some() { + t.body.anchor = anchor; + } + if let Some(m) = fit { + t.body.autofit = Some(m); + } + } let id = add_shape(s, shape, true)?; super::text::fit_text_box(s, id)?; if text.is_empty() { diff --git a/crates/engine/src/cmd/inspect.rs b/crates/engine/src/cmd/inspect.rs index db162a3..6498b73 100644 --- a/crates/engine/src/cmd/inspect.rs +++ b/crates/engine/src/cmd/inspect.rs @@ -42,6 +42,7 @@ fn document(s: &mut Session, _p: &Value) -> Result { "selection": serde_json::to_value(&st.selection).unwrap_or_default(), "media": d.media.iter().map(|x| json!({"id": x.id, "name": x.name, "type": x.content_type, "bytes": x.data.len()})).collect::>(), "undo": st.history.undo.last().map(|e| e.label.clone()), + "undoDepth": st.history.undo.len(), "redo": st.history.redo.last().map(|e| e.label.clone()), })) } diff --git a/crates/engine/src/cmd/lint.rs b/crates/engine/src/cmd/lint.rs new file mode 100644 index 0000000..b877c3a --- /dev/null +++ b/crates/engine/src/cmd/lint.rs @@ -0,0 +1,336 @@ +//! Editorial-design checks for agents (편집디자인 검사): text that overflows its box, text off the +//! slide or in the safe margin, text boxes whose text collides, low contrast (WCAG 2), text too +//! small to read, and slides with too many sizes or colours. An agent runs `design.lint` after +//! building a deck and fixes what it reports before showing the result. + +use deckcraft_color::Rgba; +use deckcraft_model::resolve::{self, Ctx}; +use deckcraft_model::style::Fill; +use deckcraft_model::text::{AutoFit, RunKind, TextBody}; +use deckcraft_model::{Shape, ShapeId, ShapeKind, Slide}; +use serde_json::{Value, json}; + +use super::*; +use crate::{Result, Session}; + +pub fn specs() -> Vec { + vec![cmd!( + query "design.lint", + "Check Design", + [], + None, + "{slide?: index, margin?: pt (12), minSize?: pt (12)} → {score 0–100 (mean of per-slide scores), errors, warnings, infos, issues: [{slide, id, kind: overflow|off-slide|margin|overlap|contrast|small-text|too-many-sizes|too-many-colors, severity: error|warning|info, message}]}", + has_doc, + lint + )] +} + +struct Issue { + slide: usize, + id: Option, + kind: &'static str, + severity: &'static str, + message: String, +} + +#[derive(Clone, Copy)] +struct Box2 { + x: f64, + y: f64, + w: f64, + h: f64, +} + +impl Box2 { + fn contains(&self, px: f64, py: f64) -> bool { + px >= self.x && px <= self.x + self.w && py >= self.y && py <= self.y + self.h + } + fn overlap(&self, o: &Box2) -> (f64, f64) { + let w = (self.x + self.w).min(o.x + o.w) - self.x.max(o.x); + let h = (self.y + self.h).min(o.y + o.h) - self.y.max(o.y); + (w.max(0.0), h.max(0.0)) + } +} + +fn lint(s: &mut Session, p: &Value) -> Result { + let st = s.doc()?; + let doc = &st.doc; + let margin = f64_or(p, "margin", 12.0); + let min_size = f64_or(p, "minSize", 12.0); + let only = usize_param(p, "slide"); + let (sw, sh) = (doc.slide_size.width, doc.slide_size.height); + let mut issues = Vec::new(); + // Each slide scores 100 − 10·errors − 4·warnings − infos (floor 0); the deck score is the + // mean, so one weak slide in a long deck shows as one weak slide, not a zero. + let mut slide_scores: Vec = Vec::new(); + for (i, slide) in doc.slides.iter().enumerate() { + if only.is_some_and(|o| o != i) || slide.hidden { + continue; + } + let Some(ctx) = Ctx::for_slide(doc, slide) else { continue }; + let from = issues.len(); + lint_slide(&ctx, slide, i, sw, sh, margin, min_size, &mut issues); + let (e, w, n) = tally(&issues[from..]); + slide_scores.push((100 - 10 * e - 4 * w - n).max(0)); + } + let (e, w, n) = tally(&issues); + let score = if slide_scores.is_empty() { 100 } else { (slide_scores.iter().sum::() as f64 / slide_scores.len() as f64).round() as i64 }; + Ok(json!({ + "score": score, + "errors": e, + "warnings": w, + "infos": n, + "issues": issues.iter().map(|x| json!({"slide": x.slide, "id": x.id, "kind": x.kind, "severity": x.severity, "message": x.message})).collect::>(), + })) +} + +/// (errors, warnings, infos) in `issues`. +fn tally(issues: &[Issue]) -> (i64, i64, i64) { + issues.iter().fold((0, 0, 0), |(e, w, n), x| match x.severity { + "error" => (e + 1, w, n), + "warning" => (e, w + 1, n), + _ => (e, w, n + 1), + }) +} + +/// A text shape's facts gathered once. +struct TextInfo { + id: ShapeId, + bx: Box2, + /// The part of the box the text actually covers (by its anchor). + ink: Box2, + filled: bool, +} + +#[allow(clippy::too_many_arguments)] +fn lint_slide(ctx: &Ctx, slide: &Slide, si: usize, sw: f64, sh: f64, margin: f64, min_size: f64, out: &mut Vec) { + let shapes: Vec<&Shape> = slide.shapes.iter().filter(|s| !s.hidden).collect(); + let boxes: Vec = shapes + .iter() + .map(|s| { + let x = resolve::xfrm(ctx, s); + Box2 { x: x.x, y: x.y, w: x.w, h: x.h } + }) + .collect(); + let bg = slide_bg(ctx, slide); + let mut texts: Vec = Vec::new(); + let mut sizes: Vec = Vec::new(); + // Text colours per surface (light / dark backdrop): a deck may use body, muted, accent and + // emphasis on each, so a dark slide band does not count against the light page. + let mut colors: Vec<(bool, String)> = Vec::new(); + let mut push = |kind: &'static str, severity: &'static str, id: Option, message: String| out.push(Issue { slide: si, id, kind, severity, message }); + + for (idx, s) in shapes.iter().enumerate() { + let bx = boxes[idx]; + let id = s.id; + // Tables: each cell's text against its own fill (cells styled by the table style are skipped). + if let ShapeKind::Table(t) = &s.kind { + for (ri, row) in t.rows.iter().enumerate() { + for (ci, cell) in row.cells.iter().enumerate() { + let cell_bg = match &cell.fill { + Some(f) => fill_color(ctx, f, None, bg), + None => None, + }; + for (fg, size, bold) in runs(ctx, s, &cell.text) { + sizes.push((size * 2.0).round() as i64); + colors.push((cell_bg.or(bg).map_or(fg.luminance() > 0.5, is_dark), fg.hex())); + if size < min_size { + push("small-text", if size < 9.0 { "error" } else { "warning" }, Some(id), format!("표 {}행 {}열 글자 {size}pt < {min_size}pt", ri + 1, ci + 1)); + } + if let Some(b) = cell_bg { + let (c, need) = (fg.contrast(b), need_contrast(size, bold)); + if c < need { + push("contrast", "error", Some(id), format!("표 {}행 {}열 대비 {:.1}:1 < {need}:1 (#{} on #{})", ri + 1, ci + 1, c, fg.hex(), b.hex())); + } + } + } + } + } + continue; + } + let Some(body) = s.text.as_ref().filter(|t| !t.text().trim().is_empty()) else { continue }; + let (own_fill, ph) = resolve::fill(ctx, s); + let filled = !matches!(own_fill, None | Some(Fill::None)); + + // Off the slide / in the safe margin (full-bleed filled bands are allowed to touch edges). + let off = bx.x < -1.0 || bx.y < -1.0 || bx.x + bx.w > sw + 1.0 || bx.y + bx.h > sh + 1.0; + if off { + push("off-slide", "error", Some(id), format!("글상자가 슬라이드 밖으로 나감 [{:.0},{:.0},{:.0},{:.0}]", bx.x, bx.y, bx.w, bx.h)); + } else { + let bleed = filled && (bx.w >= sw - 2.0 || bx.h >= sh - 2.0 || bx.x <= 1.0 || bx.y <= 1.0 || bx.x + bx.w >= sw - 1.0 || bx.y + bx.h >= sh - 1.0); + let near = bx.x < margin - 0.5 || bx.y < margin - 0.5 || bx.x + bx.w > sw - margin + 0.5 || bx.y + bx.h > sh - margin + 0.5; + if near && !bleed { + push("margin", "warning", Some(id), format!("안전 여백 {margin}pt 침범 [{:.0},{:.0},{:.0},{:.0}]", bx.x, bx.y, bx.w, bx.h)); + } + } + + // Overflow: text taller than its box (boxes that grow or shrink to their text are fine). + let bp = resolve::body(ctx, s); + let geo = deckcraft_render::shape_geometry(s, bx.w, bx.h); + let need = deckcraft_text::fit_height(ctx, s, body, geo.text_rect, &deckcraft_text::NoFields); + let room = geo.text_rect.height(); + if matches!(bp.autofit, None | Some(AutoFit::None)) && need > room + 2.0 { + push("overflow", "error", Some(id), format!("글이 넘침: 필요 {need:.0}pt, 상자 {room:.0}pt — 글을 줄이거나 상자를 키우세요")); + } + // Ink box = where the laid-out lines really are (alignment and anchor included), so two + // short labels side by side in wide boxes do not count as colliding. + let opts = deckcraft_text::Opts { rect: geo.text_rect, fields: &deckcraft_text::NoFields, prompt_color: None, no_shrink: false }; + let ink = deckcraft_text::layout(ctx, s, body, &opts).bounds(); + let ink = Box2 { x: bx.x + ink.x0, y: bx.y + ink.y0, w: ink.width(), h: ink.height() }; + texts.push(TextInfo { id, bx, ink, filled }); + + // Contrast against the shape's own fill, else what lies beneath its centre. + let back = match own_fill.as_ref().filter(|f| !matches!(f, Fill::None)) { + Some(f) => { + let under = backdrop(ctx, &shapes, &boxes, idx, bx.x + bx.w / 2.0, bx.y + bx.h / 2.0, bg); + fill_color(ctx, f, ph, under) + } + None => backdrop(ctx, &shapes, &boxes, idx, ink.x + ink.w / 2.0, ink.y + ink.h / 2.0, bg), + }; + let mut worst: Option<(f64, f64, Rgba, Rgba)> = None; + let mut smallest: Option = None; + for (fg, size, bold) in runs(ctx, s, body) { + sizes.push((size * 2.0).round() as i64); + // Unknown backdrop (picture, chart): light text means it sits on a dark surface. + colors.push((back.map_or(fg.luminance() > 0.5, is_dark), fg.hex())); + if size < min_size { + smallest = Some(smallest.map_or(size, |m: f64| m.min(size))); + } + if let Some(b) = back + && fg.a > 0 + { + let fg = blend(fg, b); + let (c, need) = (fg.contrast(b), need_contrast(size, bold)); + if c < need && worst.is_none_or(|w| c / need < w.0 / w.1) { + worst = Some((c, need, fg, b)); + } + } + } + if let Some(m) = smallest { + push("small-text", if m < 9.0 { "error" } else { "warning" }, Some(id), format!("글자 {m}pt < 최소 {min_size}pt")); + } + if let Some((c, need, fg, b)) = worst { + push("contrast", "error", Some(id), format!("명암 대비 {c:.1}:1 < {need}:1 (#{} on #{})", fg.hex(), b.hex())); + } + } + + // Colliding text: two text shapes whose text areas overlap, unless one is a filled card + // that holds the other. + for a in 0..texts.len() { + for b in a + 1..texts.len() { + let (ta, tb) = (&texts[a], &texts[b]); + let holds = |o: &TextInfo, i: &TextInfo| o.filled && o.bx.contains(i.bx.x + 1.0, i.bx.y + 1.0) && o.bx.contains(i.bx.x + i.bx.w - 1.0, i.bx.y + i.bx.h - 1.0); + if holds(ta, tb) || holds(tb, ta) { + continue; + } + let (w, h) = ta.ink.overlap(&tb.ink); + if w > 2.0 && h > 2.0 { + push("overlap", "warning", Some(tb.id), format!("글상자 {}와(과) 글이 겹침 ({w:.0}×{h:.0}pt)", ta.id)); + } + } + } + + sizes.sort_unstable(); + sizes.dedup(); + if sizes.len() > 6 { + push("too-many-sizes", "info", None, format!("글자 크기 {}종 — 6단계 이내 체계로 줄이세요", sizes.len())); + } + colors.sort_unstable(); + colors.dedup(); + for (dark, surface) in [(false, "밝은"), (true, "어두운")] { + let on: Vec = colors.iter().filter(|c| c.0 == dark).map(|c| format!("#{}", c.1)).collect(); + if on.len() > 4 { + push("too-many-colors", "info", None, format!("{surface} 바탕 글자 색 {}종 ({}) — 본문·보조·강조·포인트 4색 이내 권장", on.len(), on.join(" "))); + } + } +} + +/// A backdrop dark enough that white text reads better on it than black. +fn is_dark(c: Rgba) -> bool { + c.luminance() < 0.179 +} + +/// (colour, size pt, bold) of each visible run. +fn runs(ctx: &Ctx, s: &Shape, body: &TextBody) -> Vec<(Rgba, f64, bool)> { + let mut v = Vec::new(); + for p in &body.paragraphs { + for r in &p.runs { + if !matches!(r.kind, RunKind::Text | RunKind::Field { .. }) || r.text.trim().is_empty() { + continue; + } + let rp = resolve::run(ctx, s, p, &r.props); + v.push((resolve::text_color(ctx, &rp), rp.size.unwrap_or(18.0), rp.bold.unwrap_or(false))); + } + } + v +} + +/// WCAG 2: 4.5:1 for body text, 3:1 for large text (≥ 24pt, or ≥ 18.66pt bold). +fn need_contrast(size: f64, bold: bool) -> f64 { + if size >= 24.0 || (bold && size >= 18.66) { 3.0 } else { 4.5 } +} + +/// `top` over `under` (alpha compositing). +fn blend(top: Rgba, under: Rgba) -> Rgba { + if top.a == 255 { + return top; + } + let a = top.a as f64 / 255.0; + let mix = |t: u8, u: u8| (t as f64 * a + u as f64 * (1.0 - a)).round() as u8; + Rgba::rgb(mix(top.r, under.r), mix(top.g, under.g), mix(top.b, under.b)) +} + +/// A fill's average colour over what lies beneath; `None` for pictures and patterns (unknown). +fn fill_color(ctx: &Ctx, f: &Fill, ph: Option, under: Option) -> Option { + let base = under.unwrap_or(Rgba::WHITE); + match f { + Fill::Solid { color } => { + let c = ctx.color(color, ph); + if c.a == 255 { Some(c) } else { under.map(|u| blend(c, u)) } + } + Fill::Gradient(g) if !g.stops.is_empty() => { + let n = g.stops.len() as f64; + let (mut r, mut gg, mut b) = (0.0, 0.0, 0.0); + for s in &g.stops { + let c = blend(ctx.color(&s.color, ph), base); + r += c.r as f64; + gg += c.g as f64; + b += c.b as f64; + } + Some(Rgba::rgb((r / n).round() as u8, (gg / n).round() as u8, (b / n).round() as u8)) + } + Fill::None | Fill::Group | Fill::Background => under, + _ => None, + } +} + +fn slide_bg(ctx: &Ctx, slide: &Slide) -> Option { + let (f, ph) = resolve::background(ctx, Some(slide)); + fill_color(ctx, &f, ph, Some(Rgba::WHITE)) +} + +/// The colour under point (`px`, `py`) from the shapes below `idx` and the slide background. +#[allow(clippy::too_many_arguments)] +fn backdrop(ctx: &Ctx, shapes: &[&Shape], boxes: &[Box2], idx: usize, px: f64, py: f64, bg: Option) -> Option { + for j in (0..idx).rev() { + if !boxes[j].contains(px, py) { + continue; + } + let s = shapes[j]; + match &s.kind { + ShapeKind::Picture { .. } | ShapeKind::Media(_) | ShapeKind::Chart(_) => return None, + ShapeKind::Shape => { + let (f, ph) = resolve::fill(ctx, s); + match f { + None | Some(Fill::None) => continue, + Some(f) => { + let under = backdrop(ctx, shapes, boxes, j, px, py, bg); + return fill_color(ctx, &f, ph, under); + } + } + } + _ => continue, + } + } + bg +} diff --git a/crates/engine/src/cmd/mod.rs b/crates/engine/src/cmd/mod.rs index ce909b0..a4e25bc 100644 --- a/crates/engine/src/cmd/mod.rs +++ b/crates/engine/src/cmd/mod.rs @@ -8,6 +8,7 @@ pub mod file; pub mod format; pub mod insert; pub mod inspect; +pub mod lint; pub mod media; pub mod merge; pub mod review; @@ -141,6 +142,7 @@ pub fn command_specs() -> &'static [CommandSpec] { v.extend(table::specs()); v.extend(review::specs()); v.extend(inspect::specs()); + v.extend(lint::specs()); v.extend(media::specs()); v }) diff --git a/crates/engine/src/cmd/text.rs b/crates/engine/src/cmd/text.rs index 1b2cb2d..3b07992 100644 --- a/crates/engine/src/cmd/text.rs +++ b/crates/engine/src/cmd/text.rs @@ -767,12 +767,16 @@ pub(crate) fn format_run(s: &mut Session, f: &(dyn Fn(&mut RunProps) + Send + Sy if ids.is_empty() { return Err(bad("format", "select text or a shape")); } + let cells = st.selection.cells; edit_shapes(s, &json!({"ids": ids}), "format", |sh| { + let id = sh.id; match &mut sh.kind { ShapeKind::Table(t) => { - for row in &mut t.rows { - for c in &mut row.cells { - ed::format_all(&mut c.text, f); + for (ri, row) in t.rows.iter_mut().enumerate() { + for (ci, c) in row.cells.iter_mut().enumerate() { + if in_cells(cells, id, ri, ci) { + ed::format_all(&mut c.text, f); + } } } } @@ -789,6 +793,19 @@ pub(crate) fn format_run(s: &mut Session, f: &(dyn Fn(&mut RunProps) + Send + Sy ok() } +/// Whether table cell (r, c) of shape `id` is targeted: inside the selected cell range when +/// one is set on this table, otherwise every cell (the whole table is selected). +fn in_cells(cells: Option<(ShapeId, (usize, usize), (usize, usize))>, id: ShapeId, r: usize, c: usize) -> bool { + match cells { + Some((tid, a, b)) if tid == id => { + let (r0, r1) = (a.0.min(b.0), a.0.max(b.0)); + let (c0, c1) = (a.1.min(b.1), a.1.max(b.1)); + (r0..=r1).contains(&r) && (c0..=c1).contains(&c) + } + _ => true, + } +} + /// What `format_run` formats while editing: the selection, or for a bare caret the word it's in /// (without its trailing space). Empty when the caret is at a word boundary. fn format_range(st: &DocState, t: &TextSel) -> (Pos, Pos) { @@ -856,12 +873,16 @@ pub(crate) fn format_para(s: &mut Session, f: &(dyn Fn(&mut deckcraft_model::tex if ids.is_empty() { return Err(bad("format", "select text or a shape")); } + let cells = st.selection.cells; edit_shapes(s, &json!({"ids": ids}), "format", |sh| { + let id = sh.id; match &mut sh.kind { ShapeKind::Table(t) => { - for row in &mut t.rows { - for c in &mut row.cells { - c.text.paragraphs.iter_mut().for_each(f); + for (ri, row) in t.rows.iter_mut().enumerate() { + for (ci, c) in row.cells.iter_mut().enumerate() { + if in_cells(cells, id, ri, ci) { + c.text.paragraphs.iter_mut().for_each(f); + } } } } diff --git a/crates/engine/src/links.rs b/crates/engine/src/links.rs index ac0c787..91ee3c0 100644 --- a/crates/engine/src/links.rs +++ b/crates/engine/src/links.rs @@ -1,8 +1,9 @@ //! Community and project links (shown in Help, About, the CLI and MCP). -pub const DISCORD: &str = "https://discord.gg/artcraft"; -pub const WEBSITE: &str = "https://getartcraft.com/"; -pub const APPS: &str = "https://getartcraft.com/apps"; -pub const APP_PAGE: &str = "https://getartcraft.com/apps/deckcraft"; +// Modified by XenLook (XenSlide, 2026-10-16): XenLook links; no ArtCraft community link in the fork (brand licence). +pub const DISCORD: &str = ""; +pub const WEBSITE: &str = "https://xenlook.ai/"; +pub const APPS: &str = "https://xenlook.ai/"; +pub const APP_PAGE: &str = "https://xenlook.ai/"; pub const GITHUB: &str = "https://github.com/storytold/deckcraft"; pub const ISSUES: &str = "https://github.com/storytold/deckcraft/issues"; diff --git a/crates/engine/src/recovery.rs b/crates/engine/src/recovery.rs index 30daa81..31893bd 100644 --- a/crates/engine/src/recovery.rs +++ b/crates/engine/src/recovery.rs @@ -17,10 +17,10 @@ use crate::{DocState, EngineError, Result, Session}; pub fn default_dir() -> Option { let home = std::env::var_os("HOME").map(PathBuf::from); if cfg!(target_os = "macos") { - return home.map(|h| h.join("Library/Application Support/DeckCraft/Recovery")); + return home.map(|h| h.join("Library/Application Support/XenSlide/Recovery")); } if cfg!(target_os = "windows") { - return std::env::var_os("APPDATA").map(|a| PathBuf::from(a).join("DeckCraft").join("Recovery")); + return std::env::var_os("APPDATA").map(|a| PathBuf::from(a).join("XenSlide").join("Recovery")); } std::env::var_os("XDG_DATA_HOME").map(PathBuf::from).or_else(|| home.map(|h| h.join(".local/share"))).map(|d| d.join("deckcraft/recovery")) } diff --git a/crates/engine/src/sample.rs b/crates/engine/src/sample.rs index 80c11ca..636b815 100644 --- a/crates/engine/src/sample.rs +++ b/crates/engine/src/sample.rs @@ -15,13 +15,13 @@ fn last_id(v: &Value) -> u64 { /// Open the sample presentation in a new document. pub fn open_sample(s: &mut Session) -> Result<()> { - run(s, "file.new", json!({"theme": "DeckCraft"}))?; + run(s, "file.new", json!({"theme": "XenSlide"}))?; let st = s.doc()?; let title = st.current_slide().and_then(|x| x.shapes.first()).map(|x| x.id.0).unwrap_or(0); let sub = st.current_slide().and_then(|x| x.shapes.get(1)).map(|x| x.id.0).unwrap_or(0); run(s, "text.set", json!({"id": title, "text": "Northern Lights"}))?; run(s, "text.set", json!({"id": sub, "text": "A short tour of the aurora — where it comes from, when to look, and how to photograph it"}))?; - run(s, "slide.notes", json!({"text": "Welcome everyone. This deck was made in DeckCraft."}))?; + run(s, "slide.notes", json!({"text": "Welcome everyone. This deck was made in XenSlide."}))?; // Decorative bands on the title slide. let b = run(s, "shape.insert", json!({"preset": "rect", "rect": [0, 470, 960, 70]}))?; run(s, "shape.fill", json!({"id": last_id(&b), "gradient": {"stops": [[0, "accent1"], [0.5, "accent4"], [1, "accent2"]], "angle": 0}}))?; @@ -114,7 +114,7 @@ pub fn open_sample(s: &mut Session) -> Result<()> { run(s, "transition.set", json!({"kind": "split"}))?; // Closing. - run(s, "slide.new", json!({"layout": "title", "title": "Clear skies!", "body": "Made with DeckCraft — free and open source"}))?; + run(s, "slide.new", json!({"layout": "title", "title": "Clear skies!", "body": "Made with XenSlide — free and open source"}))?; let moon = run(s, "shape.insert", json!({"preset": "moon", "rect": [820, 40, 80, 120]}))?; run(s, "shape.fill", json!({"id": last_id(&moon), "color": "accent6"}))?; run(s, "shape.line", json!({"id": last_id(&moon), "none": true}))?; diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index e83f72e..6311bf1 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -835,3 +835,92 @@ fn slide_ranges_parse_like_powerpoints_print_box() { let opts = cmd::file::pdf_options(&json!({"slides": [0, 7, 1]}), 2).unwrap(); assert_eq!(opts.slides, Some(vec![0, 1]), "indices past the end are dropped"); } + +#[test] +fn run_format_on_cell_range_leaves_other_cells_alone() { + // Header-row recolour (select row 0, set white) must not reach body cells. + let mut s = session(); + let data = json!([["A", "B"], ["v1", "v2"], ["v3", "v4"]]); + let id = s.execute("insert.table", &json!({"rows": 3, "cols": 2, "rect": [100.0, 100.0, 400.0, 120.0], "data": data})).unwrap()["id"].clone(); + s.execute("table.selectCells", &json!({"id": id, "from": [0, 0], "to": [0, 1]})).unwrap(); + s.execute("format.color", &json!({"color": "#FFFFFF"})).unwrap(); + s.execute("format.align", &json!({"align": "center"})).unwrap(); + let st = s.doc().unwrap(); + let sh = st.shapes().iter().find(|sh| json!(sh.id) == id).unwrap().clone(); + let deckcraft_model::ShapeKind::Table(t) = &sh.kind else { panic!("not a table") }; + let fill = |r: usize, c: usize| t.cell(r, c).unwrap().text.paragraphs[0].runs[0].props.fill.clone(); + let align = |r: usize, c: usize| t.cell(r, c).unwrap().text.paragraphs[0].props.align; + assert!(fill(0, 0).is_some() && fill(0, 1).is_some(), "header cells recoloured"); + for (r, c) in [(1, 0), (1, 1), (2, 0), (2, 1)] { + assert!(fill(r, c).is_none(), "cell ({r},{c}) must keep its colour"); + assert!(align(r, c).is_none(), "cell ({r},{c}) must keep its alignment"); + } +} + +#[test] +fn text_box_middle_anchor_keeps_its_height() { + let mut s = session(); + let r = s.execute("insert.textBox", &json!({"rect": [100.0, 100.0, 300.0, 120.0], "text": "Hi", "anchor": "middle"})).unwrap(); + let st = s.doc().unwrap(); + let sh = st.shapes().iter().find(|sh| json!(sh.id) == r["id"]).unwrap().clone(); + let body = &sh.text.as_ref().unwrap().body; + assert_eq!(body.anchor, Some(deckcraft_model::text::Anchor::Middle)); + assert_eq!(body.autofit, Some(deckcraft_model::text::AutoFit::None)); + assert!((sh.xfrm.unwrap().h - 120.0).abs() < 1e-6, "height kept: {}", sh.xfrm.unwrap().h); + // Default text boxes still fit their text. + let r2 = s.execute("insert.textBox", &json!({"rect": [100.0, 300.0, 300.0, 120.0], "text": "Hi"})).unwrap(); + let st = s.doc().unwrap(); + let sh2 = st.shapes().iter().find(|sh| json!(sh.id) == r2["id"]).unwrap().clone(); + assert!(sh2.xfrm.unwrap().h < 60.0, "plain box shrinks to text: {}", sh2.xfrm.unwrap().h); +} + +#[test] +fn design_lint_reports_overflow_contrast_margin_and_small_text() { + let mut s = session(); + let kinds = |s: &mut Session| -> Vec { + let r = s.execute("design.lint", &json!({})).unwrap(); + r["issues"].as_array().unwrap().iter().map(|i| i["kind"].as_str().unwrap().to_string()).collect() + }; + // A clean, readable box inside the safe margin: no issues. + let ids: Vec<_> = s.doc().unwrap().shapes().iter().map(|x| x.id).collect(); + if !ids.is_empty() { + s.execute("edit.delete", &json!({"ids": ids})).unwrap(); + } + s.execute("insert.textBox", &json!({"rect": [100.0, 100.0, 400.0, 60.0], "text": "제목", "anchor": "middle"})).unwrap(); + s.execute("format.size", &json!({"size": 28})).unwrap(); + let k = kinds(&mut s); + assert!(k.is_empty(), "clean slide: {k:?}"); + let r = s.execute("design.lint", &json!({})).unwrap(); + assert_eq!(r["score"], 100); + + // Pale grey text on white fails contrast. + s.execute("format.size", &json!({"size": 14})).unwrap(); + s.execute("format.color", &json!({"color": "#DDDDDD"})).unwrap(); + assert!(kinds(&mut s).contains(&"contrast".to_string())); + // The same text on a dark fill passes. + s.execute("shape.fill", &json!({"color": "#0B1F18"})).unwrap(); + assert!(!kinds(&mut s).contains(&"contrast".to_string())); + + // Long text in a fixed box overflows; tiny text and a box hugging the edge are flagged. + s.execute("insert.textBox", &json!({"rect": [4.0, 300.0, 200.0, 30.0], "text": "아주 긴 문장이 이 작은 상자에 들어가지 않습니다. 줄이 여러 번 바뀌어 상자보다 훨씬 길어집니다.", "anchor": "top", "autofit": "none"})).unwrap(); + assert!(kinds(&mut s).contains(&"overflow".to_string())); + s.execute("format.size", &json!({"size": 8})).unwrap(); + let k = kinds(&mut s); + for want in ["margin", "small-text"] { + assert!(k.contains(&want.to_string()), "{want} in {k:?}"); + } + let r = s.execute("design.lint", &json!({})).unwrap(); + assert!(r["score"].as_i64().unwrap() <= 86, "score drops: {}", r["score"]); + + // Overlap is measured on the laid-out lines: two short labels whose wide boxes overlap are + // fine, a second text box on top of the first is not. + let overlaps = |s: &mut Session| kinds(s).iter().filter(|k| *k == "overlap").count(); + s.execute("insert.textBox", &json!({"rect": [300.0, 420.0, 300.0, 30.0], "text": "왼쪽", "anchor": "top"})).unwrap(); + s.execute("format.size", &json!({"size": 16})).unwrap(); + s.execute("insert.textBox", &json!({"rect": [420.0, 420.0, 300.0, 30.0], "text": "오른쪽", "anchor": "top"})).unwrap(); + s.execute("format.size", &json!({"size": 16})).unwrap(); + assert_eq!(overlaps(&mut s), 0, "side-by-side labels"); + s.execute("insert.textBox", &json!({"rect": [300.0, 424.0, 300.0, 30.0], "text": "겹친 글", "anchor": "top"})).unwrap(); + s.execute("format.size", &json!({"size": 16})).unwrap(); + assert!(overlaps(&mut s) >= 1, "stacked text"); +} diff --git a/crates/fonts/build.rs b/crates/fonts/build.rs index 76e7dc4..bb375c4 100644 --- a/crates/fonts/build.rs +++ b/crates/fonts/build.rs @@ -57,7 +57,12 @@ fn manifest(dir: &std::path::Path, manifest: &std::path::Path) -> Result Result> { let m = Manifest { format: "deckcraft".into(), version: VERSION, - generator: format!("DeckCraft {}", env!("CARGO_PKG_VERSION")), + generator: format!("XenSlide {}", env!("CARGO_PKG_VERSION")), presentation: p.clone(), }; let json = serde_json::to_vec(&m).map_err(|e| FormatError::Write(e.to_string()))?; diff --git a/crates/model/src/theme.rs b/crates/model/src/theme.rs index 582f072..7addba4 100644 --- a/crates/model/src/theme.rs +++ b/crates/model/src/theme.rs @@ -68,8 +68,8 @@ pub struct Theme { impl Default for Theme { fn default() -> Self { builtin_themes().into_iter().next().unwrap_or_else(|| Theme { - name: "DeckCraft".into(), - colors: ColorScheme { name: "DeckCraft".into(), colors: [Rgba::BLACK; 12] }, + name: "XenSlide".into(), + colors: ColorScheme { name: "XenSlide".into(), colors: [Rgba::BLACK; 12] }, fonts: FontScheme::default(), format: FormatScheme::default(), raw_extra: None, @@ -118,7 +118,7 @@ pub fn default_format() -> FormatScheme { }) }; FormatScheme { - name: "DeckCraft".into(), + name: "XenSlide".into(), fills: vec![Fill::solid(ph()), grad(110000, 92000), grad(105000, 80000)], lines: vec![Line::solid(ph(), 0.75), Line::solid(ph(), 1.0), Line::solid(ph(), 1.5)], effects: vec![ @@ -164,9 +164,9 @@ pub fn builtin_themes() -> Vec { }; vec![ t( - "DeckCraft", + "XenSlide", scheme( - "DeckCraft", + "XenSlide", ["000000", "FFFFFF", "1E2B3C", "EDEBE7", "2E6FD8", "F26B1D", "2EA36F", "8A5CD8", "D83F6B", "E3B21C", "2E6FD8", "7A5BA6"], ), "Inter", diff --git a/crates/pdf/src/lib.rs b/crates/pdf/src/lib.rs index 97eb641..5d46965 100644 --- a/crates/pdf/src/lib.rs +++ b/crates/pdf/src/lib.rs @@ -97,7 +97,7 @@ pub fn export(pres: &Presentation, opts: &PdfOptions) -> Result> { } let mut pdf = krilla::Document::new(); let title = opts.title.clone().unwrap_or_else(|| pres.props.title.clone()); - let mut meta = Metadata::new().creator("DeckCraft".into()).producer("DeckCraft".into()); + let mut meta = Metadata::new().creator("XenSlide".into()).producer("XenSlide".into()); if !title.trim().is_empty() { meta = meta.title(title); } diff --git a/crates/pptx/src/tables.rs b/crates/pptx/src/tables.rs index 24b011c..fec964b 100644 --- a/crates/pptx/src/tables.rs +++ b/crates/pptx/src/tables.rs @@ -226,7 +226,7 @@ pub fn table_styles_xml(used: &[String], defs: &[deckcraft_model::table::TableSt if !define { continue; } - let name = names.iter().find(|(id, _)| id == s).map(|(_, n)| format!("DeckCraft {n}")).unwrap_or_else(|| s.clone()); + let name = names.iter().find(|(id, _)| id == s).map(|(_, n)| format!("XenSlide {n}")).unwrap_or_else(|| s.clone()); style_def(&mut w, s, &name); } w.close("a:tblStyleLst"); diff --git a/crates/pptx/src/write/mod.rs b/crates/pptx/src/write/mod.rs index 7fb6a71..1669912 100644 --- a/crates/pptx/src/write/mod.rs +++ b/crates/pptx/src/write/mod.rs @@ -826,7 +826,7 @@ fn app_xml(p: &Presentation) -> Vec { .a("xmlns", "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties") .a("xmlns:vt", "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"), ); - w.elt("Application", "DeckCraft"); + w.elt("Application", "XenSlide"); w.elt("Slides", &p.slides.len().to_string()); w.elt("Notes", &p.slides.iter().filter(|s| !s.notes.is_empty()).count().to_string()); w.elt("HiddenSlides", &p.slides.iter().filter(|s| s.hidden).count().to_string()); diff --git a/crates/render/src/lib.rs b/crates/render/src/lib.rs index eb13955..c7e66b1 100644 --- a/crates/render/src/lib.rs +++ b/crates/render/src/lib.rs @@ -175,6 +175,9 @@ pub struct RenderOpts<'a> { pub date_text: Option, /// The local date and time date fields show (`None`: the system clock). pub now: Option, + /// Translates the empty-placeholder prompts ("Click to add title") into the interface language + /// (added by XenLook, 2026-11-17). `None` draws them in English. + pub prompt_text: Option &'static str>, } impl Default for RenderOpts<'_> { @@ -193,6 +196,7 @@ impl Default for RenderOpts<'_> { clear: None, date_text: None, now: None, + prompt_text: None, } } } @@ -1180,7 +1184,7 @@ impl Renderer { } } else if f.opts.edit && s.ph.is_some() { let kind = s.ph_type().unwrap_or(PhType::Body); - let prompt_body = prompt_body(rctx, s, kind); + let prompt_body = prompt_body(rctx, s, kind, f.opts.prompt_text); if !prompt_body.is_empty() { let grey = Rgba::rgb(0x59, 0x59, 0x59); draw_text(ctx, rctx, s, &prompt_body, tr, m, &f.fields, Some(grey)); @@ -1816,7 +1820,7 @@ fn arrowheads(ctx: &mut RenderContext, rctx: &Ctx, line: &Line, ph: Option } /// The prompt shown in an empty placeholder, formatted like its content would be. -fn prompt_body(rctx: &Ctx, s: &Shape, kind: PhType) -> TextBody { +fn prompt_body(rctx: &Ctx, s: &Shape, kind: PhType, prompt_text: Option &'static str>) -> TextBody { // Layout/master prompt text when the layout supplies a custom one. let (lp, _) = resolve::parents(rctx, s); let custom = lp.and_then(|l| l.ph.as_ref().filter(|p| p.has_custom_prompt).and(l.text.as_ref())).filter(|t| !t.is_empty()); @@ -1827,6 +1831,7 @@ fn prompt_body(rctx: &Ctx, s: &Shape, kind: PhType) -> TextBody { return TextBody::default(); } let txt = kind.prompt(); + let txt = prompt_text.map_or(txt, |f| f(txt)); if txt.is_empty() || kind.is_footer_kind() { return TextBody::default(); } diff --git a/crates/render/src/transition.rs b/crates/render/src/transition.rs index 0585144..1912c35 100644 --- a/crates/render/src/transition.rs +++ b/crates/render/src/transition.rs @@ -112,6 +112,7 @@ fn copy_opts<'a>(o: &RenderOpts<'a>) -> RenderOpts<'a> { clear: o.clear, date_text: o.date_text.clone(), now: o.now, + prompt_text: o.prompt_text, } } diff --git a/crates/ui-egui/assets/xenlook-mark-96.rgba b/crates/ui-egui/assets/xenlook-mark-96.rgba new file mode 100644 index 0000000000000000000000000000000000000000..19ba261db0772107788bcac8e8dbfc5367052102 GIT binary patch literal 36864 zcmeHw1z1%}*fmObD_~=w5_Vu%|1J3*1KlSJMYZwt)uhbzyA>U4}t#>_z!{q5cqBcvha$m zOuGL^lPJ5u;NSem=d~1gi)a7$Pey=PNSOS?wve8o#@wc?g=sc-cjIjC<&Cp@luMIr z(m9sidEav^qkD?u8U6M>_s{IPEVC%P4lz&zBKA^Yr2XSh{H40DqoawDy?aMvdyg&L z-Z!>)2lxMvCU?jfcx*AWckiS_Y-E6cxeX+(F}8PYMyxNIWGfDlWZVV*?tlHW$xY+_ zn){m1&FHx1Ip5mK^urVlSRj|l!>vO z+YRGv9s>98#eJdmf0O@z zxUAWPkM(zXQ2%aX=L!=I{KdZZ-|BO}=f2`xlT78s?W@2}U?{NE(UCEg_y6{PsqHqh zciU=`t(dBP5&8WegrvB`{Q>omqcKZm(@!%#G~a zAF>{avPrrxmmzIgHTfgBVInw^I%SiOX`ZXz|1mt|XMCgHWrC-vb;^YKROd_KTR08IX#bM5U^}RDyE}pMwN&0#DzWXWnO8?pFdX)a}nRwP;rrF#) zzM~F^*p7}AQ;_<#iqDgNSp{E=*w*QoxIo9;6%P5zqCkOSaLHc?&Up&J$uSRXY;wZX zJO>O+9FfJq5juL=p_A1?PWrii5dZJNgBUZPCgg{y1C!v2Lota55(gZMNj#8_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V6QsgW`a8qp z%%6szkmlM{*J)v>ah-BpT(86%HSeYQyXJAt{coO=Dj%BHsbg%KxC_jczt#AQ@9%J} za~B!^@B03Zs3(8({i$zYpHcoLo5`FP<<~5if=BA(;v5-cgJ?(LY?_!&RyVw_cEq{N_-o1rDQo&N* z|DOL-e}7PX_fh>Fw$x)VY4ezQ-YMnJXq%aPE7xY`T+MTo>%>;`__y}c>WyRr^4?AQ z{vf|QHA6;P#_)Sk*Ep9tq}af1iu`>^5o=BF`vsLg+TL$eii8+1ZzVi7J<|_Y0e1DVJa14;+;8QfP&#cd*0ehNV*&kwkqON7) z`?J!VEsmRsu>)!RAZ1HmlllFz#BzV*TKSp8CEatxwMr7tSMDWmm1`yK5O}KYp&VDP zRsI&|Nr`q~OoEt88g1usg+6;L6?)&{@1(&yodc?R#P1o3Z|d>6|K9hPrST0>?|vZt z%(dw~Pr09JODrDI$K1wuO!?_#_b`=#`zg&y2YcmEs{3a4`{QCPS&S$AND|ln?DgWg z8QmkJ;~C{uIiE2F6Z>MtEiK)x6?Fbt>{Fhiv "Save", Nav::Close => "Close", Nav::Options => "Options", + Nav::About => "About", + Nav::Notices => "Open-source notices", } } fn icon(self) -> Icon { @@ -118,10 +124,18 @@ impl Nav { Nav::Save => Icon::Save, Nav::Close => Icon::File, Nav::Options => Icon::Settings, + Nav::About => Icon::Info, + Nav::Notices => Icon::Link, } } } +/// The licences and notices of XenSlide and what it is built on: beside the app on the web. +#[cfg(target_arch = "wasm32")] +const NOTICES_URL: &str = "XENLOOK-NOTICE.html"; +#[cfg(not(target_arch = "wasm32"))] +const NOTICES_URL: &str = "https://xenlook.ai/vendor-oss/xenslide/XENLOOK-NOTICE.html"; + /// The side menu, top group then bottom group, in keyboard order. PowerPoint's Share (cloud) is /// left out; with nothing open only Home, New and Open stay at the top. pub fn entries(has_doc: bool) -> (Vec