DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
M14: community links — Help menu (Discord, app page, GitHub, issues, website), About splash with ArtCraft mark, start-screen community card, app-bar Discord button, app.links/help.* commands, CLI 'links', MCP websiteUrl
Brandon Thomas56cb9f5c6507
diff --git a/ASSETS.md b/ASSETS.mdindex 3fd8493fd..6ed97ea2c 100644--- a/ASSETS.md+++ b/ASSETS.md@@ -38,3 +38,7 @@ Generated-in-code art is original and has no file to list: the UI icon set (`cra| `crates/render/tests/golden/feather.png` | DesignCraft contributors (generated) | rendered by DesignCraft's own renderer (`crates/render/tests/effects.rs`, synthetic shapes and bundled fonts) | MIT OR Apache-2.0 | Golden test image for soft effects || `crates/render/tests/golden/inner-shadow.png` | DesignCraft contributors (generated) | rendered by DesignCraft's own renderer (`crates/render/tests/effects.rs`, synthetic shapes and bundled fonts) | MIT OR Apache-2.0 | Golden test image for soft effects || `crates/render/tests/golden/outer-glow.png` | DesignCraft contributors (generated) | rendered by DesignCraft's own renderer (`crates/render/tests/effects.rs`, synthetic shapes and bundled fonts) | MIT OR Apache-2.0 | Golden test image for soft effects |+| `docs/brand/artcraft-logo.svg`, `docs/brand/artcraft-logo.png` | ArtCraft / Storyteller | ArtCraft brand kit (project owner) | ArtCraft trademark — used with the owner's permission; not covered by the code licence | ArtCraft wordmark (README header) |+| `docs/brand/artcraft-logo-white.svg`, `docs/brand/artcraft-logo-white.png` | ArtCraft / Storyteller | ArtCraft brand kit (project owner) | ArtCraft trademark — used with the owner's permission; not covered by the code licence | Wordmark for dark backgrounds |+| `docs/brand/artcraft-mark.svg`, `docs/brand/artcraft-mark.png` | ArtCraft / Storyteller | ArtCraft brand kit (project owner) | ArtCraft trademark — used with the owner's permission; not covered by the code licence | The mark; its outline is drawn in code by `crates/ui-egui/src/about.rs` (About splash, start screen) |+| `docs/brand/artcraft-mark-black.svg`, `docs/brand/artcraft-mark-black.png` | ArtCraft / Storyteller | ArtCraft brand kit (project owner) | ArtCraft trademark — used with the owner's permission; not covered by the code licence | Mark for light backgrounds |diff --git a/Cargo.lock b/Cargo.lockindex e12f2872c..ea1b2fa0f 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -1113,6 +1113,17 @@ dependencies = ["objc2 0.6.4",]+[[package]]+name = "displaydoc"+version = "0.2.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.6",+]+[[package]]name = "dlib"version = "0.5.3"@@ -1246,6 +1257,7 @@ dependencies = ["raw-window-handle","smithay-clipboard","web-time",+ "webbrowser","winit",]@@ -1518,6 +1530,15 @@ version = "0.3.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"+[[package]]+name = "form_urlencoded"+version = "1.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"+dependencies = [+ "percent-encoding",+]+[[package]]name = "futures-core"version = "0.3.34"@@ -1915,6 +1936,110 @@ version = "0.4.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"+[[package]]+name = "icu_collections"+version = "2.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513"+dependencies = [+ "displaydoc",+ "potential_utf",+ "utf8_iter",+ "yoke",+ "zerofrom",+ "zerovec",+]++[[package]]+name = "icu_locale_core"+version = "2.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb"+dependencies = [+ "displaydoc",+ "litemap",+ "tinystr",+ "writeable",+ "zerovec",+]++[[package]]+name = "icu_normalizer"+version = "2.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f"+dependencies = [+ "icu_collections",+ "icu_normalizer_data",+ "icu_properties",+ "icu_provider",+ "smallvec",+ "zerovec",+]++[[package]]+name = "icu_normalizer_data"+version = "2.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0"++[[package]]+name = "icu_properties"+version = "2.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148"+dependencies = [+ "displaydoc",+ "icu_collections",+ "icu_locale_core",+ "icu_properties_data",+ "icu_provider",+ "zerotrie",+ "zerovec",+]++[[package]]+name = "icu_properties_data"+version = "2.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa"++[[package]]+name = "icu_provider"+version = "2.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73"+dependencies = [+ "displaydoc",+ "icu_locale_core",+ "writeable",+ "yoke",+ "zerofrom",+ "zerotrie",+ "zerovec",+]++[[package]]+name = "idna"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"+dependencies = [+ "idna_adapter",+ "smallvec",+ "utf8_iter",+]++[[package]]+name = "idna_adapter"+version = "1.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714"+dependencies = [+ "icu_normalizer",+ "icu_properties",+]+[[package]]name = "image"version = "0.25.10"@@ -2209,6 +2334,12 @@ version = "0.12.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"+[[package]]+name = "litemap"+version = "0.8.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae"+[[package]]name = "litrs"version = "1.0.0"@@ -2989,6 +3120,15 @@ dependencies = ["portable-atomic",]+[[package]]+name = "potential_utf"+version = "0.1.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661"+dependencies = [+ "zerovec",+]+[[package]]name = "ppv-lite86"version = "0.2.21"@@ -3841,6 +3981,16 @@ dependencies = ["strict-num",]+[[package]]+name = "tinystr"+version = "0.8.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643"+dependencies = [+ "displaydoc",+ "zerovec",+]+[[package]]name = "tokio"version = "1.53.1"@@ -4008,6 +4158,24 @@ version = "0.2.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"+[[package]]+name = "url"+version = "2.5.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"+dependencies = [+ "form_urlencoded",+ "idna",+ "percent-encoding",+ "serde",+]++[[package]]+name = "utf8_iter"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"+[[package]]name = "uuid"version = "1.26.1"@@ -4324,6 +4492,22 @@ dependencies = ["wasm-bindgen",]+[[package]]+name = "webbrowser"+version = "1.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "62c35be770821a214dbc362fc26908c853e776c0004294d0b10b8a6bad582f94"+dependencies = [+ "jni",+ "log",+ "ndk-context",+ "objc2 0.6.4",+ "objc2-app-kit 0.3.2",+ "objc2-foundation 0.3.2",+ "url",+ "web-sys",+]+[[package]]name = "weezl"version = "0.1.12"@@ -4876,6 +5060,12 @@ dependencies = ["read-fonts 0.39.2",]+[[package]]+name = "writeable"+version = "0.6.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc"+[[package]]name = "x11-dl"version = "2.21.0"@@ -5122,6 +5312,39 @@ dependencies = ["synstructure",]+[[package]]+name = "zerotrie"+version = "0.2.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f"+dependencies = [+ "displaydoc",+ "yoke",+ "zerofrom",+]++[[package]]+name = "zerovec"+version = "0.11.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8"+dependencies = [+ "yoke",+ "zerofrom",+ "zerovec-derive",+]++[[package]]+name = "zerovec-derive"+version = "0.11.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.6",+]+[[package]]name = "zip"version = "3.0.0"diff --git a/apps/designcraft-cli/src/main.rs b/apps/designcraft-cli/src/main.rsindex fef9d7335..03564f4a4 100644--- a/apps/designcraft-cli/src/main.rs+++ b/apps/designcraft-cli/src/main.rs@@ -6,6 +6,7 @@//! designcraft-cli mcp [--connect PORT] [--sample] # MCP server over stdio (docs/mcp.md)//! designcraft-cli perf [--pages N] [--frames N] [--chars N] [--images N] [--runs N] [--strict] # budgets on a synthetic stress document//! designcraft-cli bench FILE [--runs N] # the same measurements on one document+//! designcraft-cli links # Discord, website, app page and GitHub links//! ```use std::process::ExitCode;@@ -26,9 +27,20 @@ fn main() -> ExitCode {Some("mcp") => report(mcp(&args[1..])),Some("perf") => report(perf::perf(&args[1..])),Some("bench") => report(perf::bench(&args[1..])),+ Some("links") => {+ use designcraft_engine::links::*;+ println!("Discord {DISCORD}\nWebsite {WEBSITE}\nApp page {APP_PAGE}\nGitHub {GITHUB}\nIssues {ISSUES}");+ ExitCode::SUCCESS+ }_ => {eprintln!(- "usage: designcraft-cli run [--in FILE | --sample] [--cmd ID[=JSON]]... [--page N] [--scale S] [--pdf-options JSON] [--export OUT] [--all-pages DIR]\n designcraft-cli commands\n designcraft-cli mcp [--connect PORT] [--sample]\n designcraft-cli perf [--pages N] [--runs N] [--strict]\n designcraft-cli bench FILE [--runs N]"+ "usage: designcraft-cli run [--in FILE | --sample] [--cmd ID[=JSON]]... [--page N] [--scale S] [--pdf-options JSON] [--export OUT] [--all-pages DIR]\n designcraft-cli commands\n designcraft-cli mcp [--connect PORT] [--sample]\n designcraft-cli perf [--pages N] [--runs N] [--strict]\n designcraft-cli bench FILE [--runs N]\n designcraft-cli links"+ );+ eprintln!(+ "\nCommunity: {} · {} · {}",+ designcraft_engine::links::DISCORD,+ designcraft_engine::links::APP_PAGE,+ designcraft_engine::links::GITHUB);ExitCode::FAILURE}diff --git a/apps/designcraft/Cargo.toml b/apps/designcraft/Cargo.tomlindex d5c41d74a..33841e144 100644--- a/apps/designcraft/Cargo.toml+++ b/apps/designcraft/Cargo.toml@@ -12,7 +12,7 @@ workspace = true[dependencies]designcraft-engine = { workspace = true }designcraft-ui-egui = { workspace = true }-eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit", "wayland", "x11"] }+eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit", "wayland", "x11", "links"] }egui = { workspace = true }serde_json = { workspace = true }log = { workspace = true }diff --git a/apps/designcraft/src/native_menu.rs b/apps/designcraft/src/native_menu.rsindex ceb96c3ab..625087e00 100644--- a/apps/designcraft/src/native_menu.rs+++ b/apps/designcraft/src/native_menu.rs@@ -8,7 +8,7 @@ use std::str::FromStr;use designcraft_ui_egui::DesignApp;use designcraft_ui_egui::menus::{self, Item};use muda::accelerator::Accelerator;-use muda::{AboutMetadata, CheckMenuItem, Menu, MenuEvent, MenuItem, PredefinedMenuItem, Submenu};+use muda::{CheckMenuItem, Menu, MenuEvent, MenuItem, PredefinedMenuItem, Submenu};use serde_json::Value;enum Handle {@@ -37,11 +37,12 @@ impl NativeMenu {let mut counter = 0usize;// Application menu.let app_menu = Submenu::new("DesignCraft", true);+ // Our own About splash (with the community links) instead of the stock panel.+ let about = MenuItem::with_id("dc-about", "About DesignCraft", true, None);+ let discord = MenuItem::with_id("dc-discord", "Join the ArtCraft Discord…", true, None);let _ = app_menu.append_items(&[- &PredefinedMenuItem::about(- None,- Some(AboutMetadata { name: Some("DesignCraft".into()), version: Some(env!("CARGO_PKG_VERSION").into()), ..Default::default() }),- ),+ &about,+ &discord,&PredefinedMenuItem::separator(),&PredefinedMenuItem::services(None),&PredefinedMenuItem::separator(),@@ -51,6 +52,8 @@ impl NativeMenu {&PredefinedMenuItem::separator(),&PredefinedMenuItem::quit(None),]);+ items.insert("dc-about".into(), ("help.about".into(), serde_json::Value::Null, Handle::Plain(about)));+ items.insert("dc-discord".into(), ("help.discord".into(), serde_json::Value::Null, Handle::Plain(discord)));let _ = menu.append(&app_menu);for (title, entries) in menus::menu_tree() {let sub = Submenu::new(title, true);diff --git a/crates/engine/src/cmd/inspect.rs b/crates/engine/src/cmd/inspect.rsindex fbaad2b48..6ec9c7121 100644--- a/crates/engine/src/cmd/inspect.rs+++ b/crates/engine/src/cmd/inspect.rs@@ -9,6 +9,8 @@ use crate::{Result, Session};pub fn specs() -> Vec<CommandSpec> {vec![cmd!(query "document.inspect", "Inspect Document", [], None, "{} → pages, spreads, items, stories (with overset), styles, swatches, selection", has_doc, inspect),+ cmd!(query "app.links", "Community & Project Links", [], None,+ "{} → {discord, website, appPage, github, issues} (ArtCraft Discord, website, DesignCraft page and repository)", always, |_, _| Ok(crate::links::all())),cmd!(query "document.list", "List Documents", [], None, "{}", always, |s, _| {Ok(json!(s.documents().iter().enumerate().map(|(i, d)| json!({"index": i, "title": d.title(), "dirty": d.is_dirty(), "active": Some(i) == s.active_index()})).collect::<Vec<_>>()))}),diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rsindex db5561b56..0bc950d98 100644--- a/crates/engine/src/lib.rs+++ b/crates/engine/src/lib.rs@@ -7,6 +7,7 @@#![forbid(unsafe_code)]pub mod cmd;+pub mod links;pub mod sample;mod tooling;diff --git a/crates/engine/src/links.rs b/crates/engine/src/links.rsnew file mode 100644index 000000000..ead5bd6a4--- /dev/null+++ b/crates/engine/src/links.rs@@ -0,0 +1,55 @@+//! ArtCraft community and project links (Help menu, About, start screen, CLI, MCP).++use serde_json::{Value, json};++/// The app's slug on getartcraft.com and GitHub.+pub const APP: &str = "designcraft";+/// The ArtCraft community Discord.+pub const DISCORD: &str = "https://discord.gg/artcraft";+/// The ArtCraft website.+pub const WEBSITE: &str = "https://getartcraft.com";+/// DesignCraft's page on the ArtCraft website.+pub const APP_PAGE: &str = "https://getartcraft.com/apps/designcraft";+/// DesignCraft's source repository.+pub const GITHUB: &str = "https://github.com/storytold/designcraft";+/// Where to report bugs and request features.+pub const ISSUES: &str = "https://github.com/storytold/designcraft/issues";++/// All links as JSON (the `app.links` command).+pub fn all() -> Value {+ json!({+ "discord": DISCORD,+ "website": WEBSITE,+ "appPage": APP_PAGE,+ "github": GITHUB,+ "issues": ISSUES,+ })+}++/// A link by key (`discord`, `website`, `appPage`, `github`, `issues`).+pub fn get(key: &str) -> Option<&'static str> {+ Some(match key {+ "discord" => DISCORD,+ "website" => WEBSITE,+ "appPage" => APP_PAGE,+ "github" => GITHUB,+ "issues" => ISSUES,+ _ => return None,+ })+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn links_follow_the_app_slug() {+ assert!(APP_PAGE.ends_with(&format!("/apps/{APP}")));+ assert!(GITHUB.ends_with(&format!("/storytold/{APP}")));+ assert!(ISSUES.starts_with(GITHUB));+ for k in ["discord", "website", "appPage", "github", "issues"] {+ assert!(get(k).is_some_and(|u| u.starts_with("https://")), "{k}");+ assert_eq!(all()[k], get(k).unwrap());+ }+ }+}diff --git a/crates/mcp/src/server.rs b/crates/mcp/src/server.rsindex 9505732af..cd7bffda4 100644--- a/crates/mcp/src/server.rs+++ b/crates/mcp/src/server.rs@@ -134,8 +134,14 @@ impl Server {Ok(json!({"protocolVersion": version,"capabilities": {"tools": {}, "resources": {}},- "serverInfo": {"name": "designcraft", "title": "DesignCraft", "version": env!("CARGO_PKG_VERSION")},- "instructions": format!("{INSTRUCTIONS} Backend: {}.", self.backend.describe()),+ "serverInfo": {"name": "designcraft", "title": "DesignCraft", "version": env!("CARGO_PKG_VERSION"), "websiteUrl": designcraft_engine::links::APP_PAGE},+ "instructions": format!(+ "{INSTRUCTIONS} Backend: {}. Community: {} (Discord), {} (app page), {} (source). The `app.links` command returns these links.",+ self.backend.describe(),+ designcraft_engine::links::DISCORD,+ designcraft_engine::links::APP_PAGE,+ designcraft_engine::links::GITHUB+ ),}))}"ping" => Ok(json!({})),diff --git a/crates/ui-egui/src/about.rs b/crates/ui-egui/src/about.rsnew file mode 100644index 000000000..b84e5e822--- /dev/null+++ b/crates/ui-egui/src/about.rs@@ -0,0 +1,173 @@+//! Help › About DesignCraft: the splash with the ArtCraft mark, version, and community links+//! (Discord first and largest), plus the other ArtCraft apps.++use designcraft_engine::links;+use egui::{Color32, Rect, Sense, Stroke, pos2, vec2};+use serde_json::json;++use crate::DesignApp;+use crate::theme::{Tokens, semibold};++/// ArtCraft brand blue (from `docs/brand/artcraft-mark.svg`).+pub const BRAND: Color32 = Color32::from_rgb(0x4e, 0x7b, 0xfb);+/// Discord's brand colour, used for the "Join our Discord" buttons (colour only; no Discord artwork).+pub const DISCORD: Color32 = Color32::from_rgb(0x58, 0x65, 0xf2);++/// The ArtCraft mark outline (viewBox -10 -19.42 136.34 136.34), from `docs/brand/artcraft-mark.svg`.+const MARK_PATH: &str = "M104.28,49.49L81.55,0h-31.23l-3.17,4.76L14.75,53.63,0,75.85l21.55,21.55,63.79-36.94,16.99,37.04,14.01-21.74-12.06-26.27ZM32.89,65.66l32.42-48.87,10.91,23.77-43.32,25.09Z";++/// The other ArtCraft apps (app-page slug, name, what it is) — same list as the README.+pub const SIBLINGS: &[(&str, &str, &str)] = &[+ ("photocraft", "PhotoCraft", "image editing"),+ ("drawcraft", "VectorCraft", "vector illustration"),+ ("filmcraft", "FilmCraft", "video editing, color and sound"),+ ("lightcraft", "LightCraft", "photo library and raw development"),+ ("printcraft", "PrintCraft", "reading, organizing and protecting PDFs"),+ ("effectcraft", "EffectCraft", "motion graphics and visual effects"),+];++/// Paint the ArtCraft mark into `rect` (square), rasterised once per size and cached.+pub fn paint_mark(ui: &egui::Ui, rect: Rect, color: Color32) {+ use designcraft_render::vello_cpu::{self, kurbo, peniko};+ let ctx = ui.ctx();+ let ppp = ctx.pixels_per_point();+ let px = ((rect.width().min(rect.height()) * ppp).round() as u32).clamp(8, 1024);+ let key = egui::Id::new(("artcraft_mark", px, color.to_array()));+ let tex: Option<egui::TextureHandle> = ctx.data(|d| d.get_temp(key));+ let tex = tex.unwrap_or_else(|| {+ let mut rc = vello_cpu::RenderContext::new_with(px as u16, px as u16, vello_cpu::RenderSettings { num_threads: 0, ..Default::default() });+ let k = px as f64 / 136.34;+ rc.set_transform(kurbo::Affine::scale(k) * kurbo::Affine::translate((10.0, 19.42)));+ let [r, g, b, a] = color.to_srgba_unmultiplied();+ rc.set_paint(peniko::Color::from_rgba8(r, g, b, a));+ if let Ok(p) = kurbo::BezPath::from_svg(MARK_PATH) {+ rc.fill_path(&p);+ }+ rc.flush();+ let mut pm = vello_cpu::Pixmap::new(px as u16, px as u16);+ let mut res = vello_cpu::Resources::new();+ rc.render(&mut pm, &mut res);+ let ci = egui::ColorImage::from_rgba_premultiplied([px as usize, px as usize], pm.data_as_u8_slice());+ let t = ctx.load_texture("artcraft_mark", ci, egui::TextureOptions::LINEAR);+ ctx.data_mut(|d| d.insert_temp(key, t.clone()));+ t+ });+ let side = rect.width().min(rect.height());+ let r = Rect::from_center_size(rect.center(), vec2(side, side));+ ui.painter().image(tex.id(), r, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE);+}++/// A speech-bubble glyph (drawn in code) for Discord buttons.+pub fn paint_chat_icon(p: &egui::Painter, c: egui::Pos2, s: f32, color: Color32) {+ let body = Rect::from_center_size(c - vec2(0.0, s * 0.06), vec2(s, s * 0.72));+ p.rect_filled(body, s * 0.24, color);+ let tail = vec![+ pos2(body.left() + s * 0.22, body.bottom() - 1.0),+ pos2(body.left() + s * 0.12, body.bottom() + s * 0.24),+ pos2(body.left() + s * 0.44, body.bottom() - 1.0),+ ];+ p.add(egui::Shape::convex_polygon(tail, color, Stroke::NONE));+ let eye = s * 0.09;+ let bg = if color.r() as u32 + color.g() as u32 + color.b() as u32 > 380 { DISCORD } else { Color32::WHITE };+ p.circle_filled(body.center() - vec2(s * 0.18, 0.0), eye, bg);+ p.circle_filled(body.center() + vec2(s * 0.18, 0.0), eye, bg);+}++/// The big "Join our Discord" button. Returns true when clicked.+pub fn discord_button(ui: &mut egui::Ui, label: &str, size: egui::Vec2) -> bool {+ let (r, resp) = ui.allocate_exact_size(size, Sense::click());+ let resp = resp.on_hover_text(links::DISCORD).on_hover_cursor(egui::CursorIcon::PointingHand);+ let fill = if resp.hovered() { Color32::from_rgb(0x47, 0x52, 0xc4) } else { DISCORD };+ ui.painter().rect_filled(r, size.y / 2.0, fill);+ let icon = size.y * 0.5;+ let font = semibold((size.y * 0.42).max(11.0));+ let galley = ui.painter().layout_no_wrap(label.to_string(), font, Color32::WHITE);+ let total = icon + 8.0 + galley.size().x;+ let x0 = r.center().x - total / 2.0;+ paint_chat_icon(ui.painter(), pos2(x0 + icon / 2.0, r.center().y), icon, Color32::WHITE);+ ui.painter().galley(pos2(x0 + icon + 8.0, r.center().y - galley.size().y / 2.0), galley, Color32::WHITE);+ resp.clicked()+}++/// A text link that opens `url`. Returns true when clicked.+fn link(ui: &mut egui::Ui, text: &str, url: &str, color: Color32) -> bool {+ let resp = ui.add(egui::Label::new(egui::RichText::new(text).size(13.0).color(color).underline()).sense(Sense::click()));+ let resp = resp.on_hover_text(url).on_hover_cursor(egui::CursorIcon::PointingHand);+ resp.clicked()+}++pub fn show(app: &mut DesignApp, ctx: &egui::Context) {+ if !app.ui.about {+ return;+ }+ let t = Tokens::get(ctx);+ let mut open: Option<&'static str> = None;+ let resp = egui::Modal::new(egui::Id::new("about")).show(ctx, |ui| {+ ui.set_width(460.0);+ ui.vertical_centered(|ui| {+ ui.add_space(8.0);+ let (r, _) = ui.allocate_exact_size(vec2(72.0, 72.0), Sense::hover());+ paint_mark(ui, r, BRAND);+ ui.add_space(6.0);+ ui.label(egui::RichText::new("DesignCraft").font(semibold(26.0)).color(t.text_strong));+ ui.label(egui::RichText::new(format!("Version {}", env!("CARGO_PKG_VERSION"))).size(12.0).color(t.text_dim));+ ui.add_space(4.0);+ ui.label(egui::RichText::new("Page layout for print and screen — fast, open and scriptable.").size(13.0).color(t.text));+ ui.label(egui::RichText::new("Part of the ArtCraft suite of open creative tools.").size(12.0).color(t.text_dim));+ ui.add_space(16.0);+ if discord_button(ui, "Join the ArtCraft Discord", vec2(300.0, 40.0)) {+ open = Some("discord");+ }+ ui.add_space(4.0);+ ui.label(egui::RichText::new("discord.gg/artcraft — help, feedback and show-and-tell").size(11.0).color(t.text_dim));+ ui.add_space(14.0);+ ui.horizontal(|ui| {+ // Centre the row of links.+ let w = 330.0;+ ui.add_space(((ui.available_width() - w) / 2.0).max(0.0));+ for (text, key) in+ [("DesignCraft page", "appPage"), ("GitHub", "github"), ("getartcraft.com", "website"), ("Report an issue", "issues")]+ {+ if link(ui, text, links::get(key).unwrap_or_default(), t.accent) {+ open = Some(key);+ }+ ui.add_space(6.0);+ }+ });+ ui.add_space(16.0);+ ui.separator();+ ui.add_space(6.0);+ ui.label(egui::RichText::new("More ArtCraft apps").font(semibold(12.0)).color(t.text_strong));+ ui.add_space(4.0);+ ui.horizontal(|ui| {+ let pad = ui.spacing().button_padding.x * 2.0 + ui.spacing().item_spacing.x;+ let w: f32 = SIBLINGS+ .iter()+ .map(|(_, n, _)| ui.painter().layout_no_wrap(n.to_string(), egui::FontId::proportional(12.0), Color32::WHITE).size().x + pad)+ .sum::<f32>()+ - ui.spacing().item_spacing.x;+ ui.add_space(((ui.available_width() - w) / 2.0).max(0.0));+ for (slug, name, what) in SIBLINGS {+ let url = format!("{}/apps/{slug}", links::WEBSITE);+ let b =+ ui.add(egui::Button::new(egui::RichText::new(*name).size(12.0)).corner_radius(10.0)).on_hover_text(format!("{what} — {url}"));+ if b.clicked() {+ app.ui.pending_urls.push(url);+ }+ }+ });+ ui.add_space(12.0);+ ui.label(egui::RichText::new("Open source. No telemetry.").size(11.0).color(t.text_dim));+ ui.add_space(8.0);+ if ui.button(" Close ").clicked() {+ app.ui.about = false;+ }+ });+ });+ if resp.should_close() {+ app.ui.about = false;+ }+ if let Some(k) = open {+ let _ = app.run(&format!("help.{k}"), json!({}));+ }+}diff --git a/crates/ui-egui/src/chrome.rs b/crates/ui-egui/src/chrome.rsindex 77d7575bf..421b39274 100644--- a/crates/ui-egui/src/chrome.rs+++ b/crates/ui-egui/src/chrome.rs@@ -53,6 +53,11 @@ pub fn app_bar(app: &mut DesignApp, ui: &mut egui::Ui) {if icons::button(ui, "share", 22.0, false, "Share").clicked() {app.status("Export a PDF, IDML or package to share — no cloud account needed.");}+ ui.add_space(8.0);+ // Always one click away: the ArtCraft community Discord.+ if crate::about::discord_button(ui, "Discord", vec2(78.0, 22.0)) {+ let _ = app.run("help.discord", json!({}));+ }});});// Centred title.@@ -505,7 +510,9 @@ pub fn start_screen(app: &mut DesignApp, ui: &mut egui::Ui) {let _ = app.run("file.newSample", json!({}));}});- ui.add_space(28.0);+ ui.add_space(20.0);+ community_card(app, ui);+ ui.add_space(24.0);ui.label(egui::RichText::new("Start a new document").font(semibold(15.0)).color(t.text_strong));ui.add_space(8.0);ui.horizontal_wrapped(|ui| {@@ -532,3 +539,39 @@ pub fn start_screen(app: &mut DesignApp, ui: &mut egui::Ui) {});let _ = Content::Unassigned;}++/// Start screen: the ArtCraft community (Discord first) and project links.+fn community_card(app: &mut DesignApp, ui: &mut egui::Ui) {+ let t = Tokens::get(ui.ctx());+ egui::Frame::NONE.fill(t.panel).corner_radius(10.0).inner_margin(egui::Margin::same(14)).show(ui, |ui| {+ ui.set_max_width(640.0);+ ui.horizontal(|ui| {+ let (r, _) = ui.allocate_exact_size(vec2(44.0, 44.0), Sense::hover());+ crate::about::paint_mark(ui, r, crate::about::BRAND);+ ui.add_space(8.0);+ ui.vertical(|ui| {+ ui.label(egui::RichText::new("Join the ArtCraft community").font(semibold(14.0)).color(t.text_strong));+ ui.label(egui::RichText::new("Get help, share your layouts and shape what we build next.").size(12.0).color(t.text_dim));+ ui.add_space(4.0);+ ui.horizontal(|ui| {+ for (text, id) in [("DesignCraft page", "help.appPage"), ("GitHub", "help.github"), ("getartcraft.com", "help.website")] {+ let url = designcraft_engine::links::get(&id[5..]).unwrap_or_default();+ let l = ui+ .add(egui::Label::new(egui::RichText::new(text).size(12.0).color(t.accent).underline()).sense(Sense::click()))+ .on_hover_text(url)+ .on_hover_cursor(egui::CursorIcon::PointingHand);+ if l.clicked() {+ let _ = app.run(id, json!({}));+ }+ ui.add_space(8.0);+ }+ });+ });+ ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {+ if crate::about::discord_button(ui, "Join our Discord", vec2(190.0, 38.0)) {+ let _ = app.run("help.discord", json!({}));+ }+ });+ });+ });+}diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rsindex ba0409639..0f923bb4d 100644--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@ -5,6 +5,7 @@//! the control channel ([`control`]) share that entry point.#![forbid(unsafe_code)]+pub mod about;pub mod canvas;pub mod chrome;pub mod control;@@ -101,6 +102,10 @@ pub struct UiState {pub smart_guides: bool,/// Window > Contextual Task Bar.pub task_bar: bool,+ /// Help › About DesignCraft is open.+ pub about: bool,+ /// URLs to open in the browser on the next frame (Help links, About, start screen).+ pub pending_urls: Vec<String>,#[serde(skip)]pub status: String,#[serde(skip)]@@ -136,6 +141,8 @@ impl Default for UiState {guides_locked: false,smart_guides: true,task_bar: true,+ about: false,+ pending_urls: Vec::new(),status: String::new(),dialog: None,palette: None,@@ -450,7 +457,11 @@ impl DesignApp {dock::flyout(self, &ctx);story_editor::show(self, &ctx);dialogs::show(self, &ctx);+ about::show(self, &ctx);menus::palette(self, &ctx);+ for url in std::mem::take(&mut self.ui.pending_urls) {+ ctx.open_url(egui::OpenUrl::new_tab(url));+ }self.perf.frame_ms = now_ms() - t0;}diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rsindex 3382b13b4..edb683e32 100644--- a/crates/ui-egui/src/menus.rs+++ b/crates/ui-egui/src/menus.rs@@ -43,6 +43,13 @@ pub const UI_COMMANDS: &[(&str, &str, Option<&str>, &str)] = &[),("window.controlBar", "Control", Some("Cmd+Alt+6"), "{}"),("window.taskBar", "Contextual Task Bar", None, "{}"),+ ("help.discord", "Join the ArtCraft Discord…", None, "{} — opens https://discord.gg/artcraft in the browser"),+ ("help.appPage", "DesignCraft Website…", None, "{} — opens https://getartcraft.com/apps/designcraft"),+ ("help.github", "DesignCraft on GitHub…", None, "{} — opens https://github.com/storytold/designcraft"),+ ("help.issues", "Report an Issue…", None, "{} — opens the GitHub issue tracker"),+ ("help.website", "ArtCraft Website…", None, "{} — opens https://getartcraft.com"),+ ("help.app", "ArtCraft App Page…", None, "{app} — opens https://getartcraft.com/apps/{app} (e.g. photocraft)"),+ ("help.about", "About DesignCraft", None, "{open?: true} — the About splash with community links (open: false closes it)"),("window.toolsDoubleColumn", "Tools: Double Column", None, "{}"),("window.workspace",@@ -201,7 +208,21 @@ pub const MENUS: &[(&str, &[&str])] = &[],),("Window", &["ui:window.controlBar", "ui:window.taskBar", "ui:window.toolsDoubleColumn", "-", "ui:window.panel", "-", "ui:window.brightness"]),- ("Help", &["cmd:file.newSample"]),+ (+ "Help",+ &[+ "ui:help.discord",+ "-",+ "ui:help.appPage",+ "ui:help.github",+ "ui:help.issues",+ "ui:help.website",+ "-",+ "cmd:file.newSample",+ "-",+ "ui:help.about",+ ],+ ),];pub fn ui_label(id: &str) -> Option<(&'static str, Option<&'static str>)> {@@ -341,6 +362,23 @@ pub fn run_ui(app: &mut DesignApp, id: &str, p: &Value) -> Option<Result<Value,}"window.controlBar" => flag(&mut app.ui.control_bar),"window.taskBar" => flag(&mut app.ui.task_bar),+ "help.about" => {+ app.ui.about = p.get("open").and_then(Value::as_bool).unwrap_or(true);+ Ok(json!(app.ui.about))+ }+ "help.app" => match p.get("app").and_then(Value::as_str) {+ Some(slug) if !slug.is_empty() && slug.chars().all(|c| c.is_ascii_alphanumeric() || c == '-') => {+ let url = format!("{}/apps/{slug}", designcraft_engine::links::WEBSITE);+ app.ui.pending_urls.push(url.clone());+ Ok(json!({"url": url}))+ }+ _ => Err("help.app: give `app` (e.g. \"photocraft\")".into()),+ },+ h if h.starts_with("help.") && designcraft_engine::links::get(&h[5..]).is_some() => {+ let url = designcraft_engine::links::get(&h[5..]).unwrap_or_default().to_string();+ app.ui.pending_urls.push(url.clone());+ Ok(json!({"url": url}))+ }"window.toolsDoubleColumn" => flag(&mut app.ui.tools_double_column),"window.workspace" => {let name = p.get("name").and_then(Value::as_str).unwrap_or("Essentials");diff --git a/docs/mcp.md b/docs/mcp.mdindex 4ed2a3e87..d9185d208 100644--- a/docs/mcp.md+++ b/docs/mcp.md@@ -90,3 +90,7 @@ type_text {"text": "Hello"}key {"key": "Enter"}key {"key": "Escape"}```++## Community links++`app.links` returns the ArtCraft Discord (https://discord.gg/artcraft), the website (https://getartcraft.com), DesignCraft's app page (https://getartcraft.com/apps/designcraft), its GitHub repository (https://github.com/storytold/designcraft) and the issue tracker. In the running app, the UI commands `help.discord`, `help.appPage`, `help.github`, `help.issues`, `help.website`, `help.app {app}` open them in the browser and `help.about` shows the About splash. The server's `serverInfo.websiteUrl` is the app page.