Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

feat(styles): object styles carry effects (#653)

aiongg98ff430022d1
diff --git a/ROADMAP.md b/ROADMAP.md
index 91a951616..e1a6d9f07 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -2,7 +2,7 @@
**Stage: pre-alpha** · next: alpha, ~0% and ~15–25 h away; beta ~28 points and ~420–750 h beyond that (the core-workflow gate, not the percentage: ready for real work is already ~47%)
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (cancelable macOS Dock Quit) · **Target:** Adobe InDesign 2026
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-13 · **Change:** minor (object styles carry effects) · **Target:** Adobe InDesign 2026
DesignCraft aims at full Adobe InDesign parity, and to be better: faster, open (documented JSON
format + IDML), scriptable by agents (MCP), and available on the web.
@@ -129,6 +129,7 @@ list) · [roadmap.md](docs/roadmap.md) (milestones, plan) · [parity-checklist.m
Newest first.
+- **2026-10-13** · Object styles carry effects (drop shadow, feather, inner and outer shadows and glows, bevel, satin, gradient and directional feather). New styles from a selection keep its effects, `style.object.edit` changes a style's effects and every item that follows them, `style.object.clearOverrides` returns items to their style, and IDML ObjectStyles write and read the drop shadow and feather (#653). No readiness percentage change.
- **2026-10-12** · macOS Dock Quit uses the same unsaved-document prompts as window and menu Quit. Repeated requests keep the current answers; Cancel retains every tab and unsaved recovery checkpoint, and completed Save/Don't Save answers exit through the ordinary event loop. No readiness percentage change.
- **2026-10-12** · Orderly native exit writes the latest recovery state after finalizing current quit approvals; incomplete or stale plans keep their documents, and Undo to the saved state clears stale recovery. Unavailable or failed recovery is reported. Cancelable macOS Dock Quit remains open (#544). No readiness percentage change.
- **2026-10-12** · Recovered documents keep a checkpoint until saved, closed or reverted, including a second crash before autosave. Restarted document IDs and explicit recovery folders preserve other snapshots; failed republishing retains the original. No readiness percentage change.
diff --git a/crates/doc/src/edit.rs b/crates/doc/src/edit.rs
index 3bb827135..90bf45012 100644
--- a/crates/doc/src/edit.rs
+++ b/crates/doc/src/edit.rs
@@ -368,6 +368,50 @@ impl Document {
v
}
+ /// Calls `f` on every item `hit` selects: on document and parent spreads, inside groups and
+ /// among anchored objects. Only the branches holding a hit are copied (copy-on-write). Returns
+ /// how many items `f` saw.
+ pub fn update_items(&mut self, hit: impl Fn(&Item) -> bool, mut f: impl FnMut(&mut Item)) -> usize {
+ const MAX_GROUP_DEPTH: usize = 64;
+ fn any(it: &Item, hit: &impl Fn(&Item) -> bool) -> bool {
+ let mut found = false;
+ it.walk(&mut |i| found |= hit(i));
+ found
+ }
+ fn update(it: &mut Item, hit: &impl Fn(&Item) -> bool, f: &mut impl FnMut(&mut Item), n: &mut usize, depth: usize) {
+ if hit(it) {
+ f(it);
+ *n += 1;
+ }
+ if depth >= MAX_GROUP_DEPTH {
+ return;
+ }
+ if let Some(children) = it.children_mut() {
+ for c in children.iter_mut().filter(|c| any(c, hit)) {
+ update(Arc::make_mut(c), hit, f, n, depth + 1);
+ }
+ }
+ }
+ let mut n = 0;
+ for sp in self.spreads.iter_mut().chain(self.parents.iter_mut()) {
+ if !sp.items.iter().any(|i| any(i, &hit)) {
+ continue;
+ }
+ for it in Arc::make_mut(sp).items.iter_mut().filter(|i| any(i, &hit)) {
+ update(Arc::make_mut(it), &hit, &mut f, &mut n, 0);
+ }
+ }
+ for st in self.stories.values_mut() {
+ if !st.objects.iter().any(|o| any(&o.item, &hit)) {
+ continue;
+ }
+ for o in Arc::make_mut(st).objects.iter_mut().filter(|o| any(&o.item, &hit)) {
+ update(&mut Arc::make_mut(o).item, &hit, &mut f, &mut n, 0);
+ }
+ }
+ n
+ }
+
/// Plain story text with frame/story stats (for agents).
pub fn story_summary(&self, sid: StoryId) -> Option<serde_json::Value> {
let st = self.story(sid)?;
diff --git a/crates/doc/src/styles.rs b/crates/doc/src/styles.rs
index e348ff295..de76c7f11 100644
--- a/crates/doc/src/styles.rs
+++ b/crates/doc/src/styles.rs
@@ -3,7 +3,7 @@
use serde::{Deserialize, Serialize};
use crate::attrs::{CharAttrs, CharProps, ParaAttrs, ParaProps};
-use crate::item::{Fill, Stroke, TextFrameOptions};
+use crate::item::{Effects, Fill, Stroke, TextFrameOptions};
use crate::story::{BASIC_PARAGRAPH, CharFormat, NO_CHAR_STYLE, ParaFormat};
pub const NO_PARA_STYLE: &str = "[No Paragraph Style]";
@@ -55,6 +55,10 @@ pub struct ObjectStyle {
pub paragraph_style: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub text_frame: Option<TextFrameOptions>,
+ /// Effects (drop shadow, feather, glows…). An item using the style follows them until its own
+ /// effects differ from the style's (a local override).
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub effects: Option<Effects>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
diff --git a/crates/engine/src/cmd/style.rs b/crates/engine/src/cmd/style.rs
index 4bf69ec41..44eec0ba5 100644
--- a/crates/engine/src/cmd/style.rs
+++ b/crates/engine/src/cmd/style.rs
@@ -1,7 +1,7 @@
//! Paragraph / character styles and swatches.
use designcraft_color::{Swatch, SwatchValue};
-use designcraft_doc::{CharAttrs, CharacterStyle, ParaAttrs, ParagraphStyle, Styles};
+use designcraft_doc::{CharAttrs, CharacterStyle, Effects, Item, ObjectStyle, ParaAttrs, ParagraphStyle, Styles};
use serde_json::{Value, json};
use super::{CommandSpec, bad, cmd, has_doc, has_text_or_frames, ok, str_param};
@@ -128,8 +128,42 @@ pub fn specs() -> Vec<CommandSpec> {
"table": st.doc.styles.table.iter().map(|p| &p.name).collect::<Vec<_>>(),
}))
}),
- cmd!("style.object.apply", "Apply Object Style", [], None, "{name, ids?}", super::has_selection, apply_object),
- cmd!("style.object.create", "New Object Style…", [], None, "{name, fromSelection?: true, fill?, paragraphStyle?}", has_doc, create_object),
+ cmd!(
+ "style.object.apply",
+ "Apply Object Style",
+ [],
+ None,
+ "{name, ids?} — sets the style's fill, stroke, effects and text frame options on the items",
+ super::has_selection,
+ apply_object
+ ),
+ cmd!(
+ "style.object.create",
+ "New Object Style…",
+ [],
+ None,
+ "{name, fromSelection?: true (fill, stroke, effects and text frame options of the first selected item), fill?, paragraphStyle?, effects?: {dropShadow?, feather?, innerShadow?, outerGlow?, innerGlow?, bevel?, satin?, gradientFeather?, directionalFeather?}, dropShadow?: {on?, color?, opacity? (0–1), angle?, globalLight?, distance?, size?, spread?}, feather?: width, innerShadow?, outerGlow?, innerGlow?, bevel?, satin?, gradientFeather?, directionalFeather?} → {name} (made unique)",
+ has_doc,
+ create_object
+ ),
+ cmd!(
+ "style.object.edit",
+ "Object Style Options…",
+ [],
+ None,
+ "{name, effects?: {…} | null (the style no longer sets effects), dropShadow?, feather?, innerShadow?, outerGlow?, innerGlow?, bevel?, satin?, gradientFeather?, directionalFeather?} — effect objects merge field by field into the style's effects (fields as in `document.inspect` item effects); items using the style whose effects match the style's take the new effects, items with their own effects keep them → {name, updated}",
+ has_doc,
+ edit_object
+ ),
+ cmd!(
+ "style.object.clearOverrides",
+ "Clear Object Style Overrides",
+ [],
+ None,
+ "{ids?} — each item takes its object style's fill, stroke, effects and text frame options again",
+ super::has_selection,
+ clear_object_overrides
+ ),
cmd!(
"swatch.create",
"New Color Swatch…",
@@ -746,16 +780,8 @@ fn apply_object(s: &mut Session, p: &Value) -> Result<Value> {
for id in &ids {
let Some(it) = d.item_mut(*id) else { continue };
it.object_style = name.clone();
- if let Some(f) = &os.fill {
- it.fill = f.clone();
- }
- if let Some(st) = &os.stroke {
- it.stroke = st.clone();
- }
- if let Some(tf) = it.text_frame_mut() {
- if let Some(o) = &os.text_frame {
- tf.options = o.clone();
- }
+ set_object_attrs(it, &os);
+ if let Some(tf) = it.text_frame() {
stories.push(tf.story);
}
}
@@ -771,15 +797,89 @@ fn apply_object(s: &mut Session, p: &Value) -> Result<Value> {
})
}
+/// Gives `it` the attributes the object style `os` sets.
+fn set_object_attrs(it: &mut Item, os: &ObjectStyle) {
+ if let Some(f) = &os.fill {
+ it.fill = f.clone();
+ }
+ if let Some(st) = &os.stroke {
+ it.stroke = st.clone();
+ }
+ if let Some(e) = &os.effects {
+ it.effects = e.clone();
+ }
+ if let (Some(tf), Some(o)) = (it.text_frame_mut(), &os.text_frame) {
+ tf.options = o.clone();
+ }
+}
+
+fn clear_object_overrides(s: &mut Session, p: &Value) -> Result<Value> {
+ let ids = super::targets(s, p)?;
+ s.edit(|d, _| {
+ for id in &ids {
+ let Some(os) = d.item(*id).and_then(|it| d.styles.object_style(&it.object_style)).cloned() else { continue };
+ if let Some(it) = d.item_mut(*id) {
+ set_object_attrs(it, &os);
+ }
+ }
+ Ok(Value::Null)
+ })
+}
+
+/// Effect keys accepted at the top level of `style.object.create` / `edit` as shorthand for
+/// `effects.<key>`.
+const EFFECT_KEYS: [&str; 9] =
+ ["dropShadow", "feather", "innerShadow", "outerGlow", "innerGlow", "bevel", "satin", "gradientFeather", "directionalFeather"];
+
+/// The effects `p` gives (`effects`, then the top-level effect keys) merged field by field over
+/// `base`, or `None` when `p` names no effect.
+fn effects_param(cmd: &str, p: &Value, base: &Effects) -> Result<Option<Effects>> {
+ let mut patch = serde_json::Map::new();
+ match p.get("effects") {
+ None | Some(Value::Null) => {}
+ Some(Value::Object(o)) => patch.extend(o.iter().map(|(k, v)| (k.clone(), v.clone()))),
+ Some(_) => return Err(bad(cmd, "`effects` must be an object or null")),
+ }
+ for k in EFFECT_KEYS {
+ if let Some(v) = p.get(k) {
+ patch.insert(k.to_string(), v.clone());
+ }
+ }
+ if patch.is_empty() {
+ return Ok(None);
+ }
+ let mut v = serde_json::to_value(base).map_err(|e| bad(cmd, e.to_string()))?;
+ merge_json(&mut v, Value::Object(patch), 0);
+ serde_json::from_value(v).map(Some).map_err(|e| bad(cmd, format!("effects: {e}")))
+}
+
+/// Merges `top` into `base`: objects key by key, anything else replaced.
+fn merge_json(base: &mut Value, top: Value, depth: usize) {
+ match (base, top) {
+ (Value::Object(b), Value::Object(t)) if depth < 8 => {
+ for (k, v) in t {
+ match b.get_mut(&k) {
+ Some(slot) => merge_json(slot, v, depth + 1),
+ None => {
+ b.insert(k, v);
+ }
+ }
+ }
+ }
+ (b, t) => *b = t,
+ }
+}
+
fn create_object(s: &mut Session, p: &Value) -> Result<Value> {
let base = str_param(p, "name").unwrap_or("Object Style 1").to_string();
let from_sel = p.get("fromSelection").and_then(Value::as_bool).unwrap_or(true);
let src = if from_sel { s.doc()?.selection.items.first().and_then(|i| s.doc().ok()?.doc.item(*i).cloned()) } else { None };
- let mut os = designcraft_doc::ObjectStyle::default();
+ let mut os = ObjectStyle::default();
if let Some(it) = &src {
os.fill = Some(it.fill.clone());
os.stroke = Some(it.stroke.clone());
os.text_frame = it.text_frame().map(|t| t.options.clone());
+ os.effects = Some(it.effects.clone());
}
if let Some(sw) = str_param(p, "fill") {
os.fill = Some(designcraft_doc::Fill::swatch(sw));
@@ -787,6 +887,9 @@ fn create_object(s: &mut Session, p: &Value) -> Result<Value> {
if let Some(ps) = str_param(p, "paragraphStyle") {
os.paragraph_style = Some(ps.to_string());
}
+ if let Some(e) = effects_param("style.object.create", p, os.effects.as_ref().unwrap_or(&Effects::default()))? {
+ os.effects = Some(e);
+ }
s.edit(|d, _| {
let name = Styles::unique_name(|n| d.styles.object_style(n).is_some(), &base);
os.name = name.clone();
@@ -795,6 +898,41 @@ fn create_object(s: &mut Session, p: &Value) -> Result<Value> {
})
}
+fn edit_object(s: &mut Session, p: &Value) -> Result<Value> {
+ const CMD: &str = "style.object.edit";
+ let name = str_param(p, "name").ok_or_else(|| bad(CMD, "missing name"))?.to_string();
+ if name == designcraft_doc::NO_OBJECT_STYLE {
+ return Err(bad(CMD, format!("`{name}` can't be edited")));
+ }
+ let old = s.doc()?.doc.styles.object_style(&name).cloned().ok_or_else(|| bad(CMD, format!("no object style `{name}`")))?;
+ let effects = if p.get("effects").is_some_and(Value::is_null) {
+ if EFFECT_KEYS.iter().any(|k| p.get(k).is_some()) {
+ return Err(bad(CMD, "`effects: null` can't be combined with effect settings"));
+ }
+ None
+ } else {
+ match effects_param(CMD, p, old.effects.as_ref().unwrap_or(&Effects::default()))? {
+ Some(e) => Some(e),
+ None => return Ok(json!({"name": name, "updated": 0})),
+ }
+ };
+ s.edit(|d, _| {
+ let Some(os) = d.styles_mut().object.iter_mut().find(|o| o.name == name) else {
+ return Err(bad(CMD, format!("no object style `{name}`")));
+ };
+ os.effects = effects.clone();
+ // An item follows the style while its effects are the style's; when the style didn't set
+ // effects before, every item using it takes them.
+ let updated = match &effects {
+ Some(new) => {
+ d.update_items(|it| it.object_style == name && old.effects.as_ref().is_none_or(|e| it.effects == *e), |it| it.effects = new.clone())
+ }
+ None => 0,
+ };
+ Ok(json!({"name": name, "updated": updated}))
+ })
+}
+
/// The swatch name of a colour value ("C=… M=… Y=… K=…" / "R=… G=… B=…").
fn value_name(color: designcraft_color::Color) -> String {
match color {
diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs
index 17d1ed098..a3b1e9897 100644
--- a/crates/engine/src/tests.rs
+++ b/crates/engine/src/tests.rs
@@ -438,6 +438,61 @@ fn object_styles_create_and_apply() {
assert_eq!(ib.object_style, "Magenta Box");
}
+#[test]
+fn object_style_effects_follow_the_style_until_overridden() {
+ use designcraft_doc::{BASIC_GRAPHICS_FRAME, ItemId};
+ let mut s = session();
+ let frame = |s: &mut Session, x: f64| {
+ let r = s.execute("frame.create", &json!({"rect": [x, 36, x + 100.0, 136], "content": "unassigned"})).unwrap();
+ r["id"].as_u64().unwrap()
+ };
+ let item = |s: &Session, id: u64| s.doc().unwrap().doc.item(ItemId(id)).unwrap().clone();
+ let shadow = |s: &Session, id: u64| item(s, id).effects.drop_shadow;
+ let a = frame(&mut s, 36.0);
+ s.execute("object.dropShadow", &json!({"on": true, "distance": 0, "size": 12, "opacity": 0.28, "ids": [a]})).unwrap();
+ s.execute("selection.set", &json!({"ids": [a]})).unwrap();
+ s.execute("style.object.create", &json!({"name": "Photo", "fromSelection": true})).unwrap();
+ let b = frame(&mut s, 200.0);
+ let c = frame(&mut s, 360.0);
+ s.execute("style.object.apply", &json!({"name": "Photo", "ids": [a, b, c]})).unwrap();
+ assert_eq!(shadow(&s, b), shadow(&s, a));
+ assert!(shadow(&s, b).on && shadow(&s, b).size == 12.0);
+ s.execute("object.dropShadow", &json!({"on": true, "size": 30, "ids": [c]})).unwrap();
+
+ // Editing the style updates the items that follow it; `c`'s local shadow stays.
+ let r = s.execute("style.object.edit", &json!({"name": "Photo", "dropShadow": {"size": 20}})).unwrap();
+ assert_eq!(r["updated"], 2);
+ assert_eq!((shadow(&s, a).size, shadow(&s, b).size, shadow(&s, c).size), (20.0, 20.0, 30.0));
+ assert_eq!(shadow(&s, a).opacity, 0.28);
+ s.execute("style.object.clearOverrides", &json!({"ids": [c]})).unwrap();
+ assert_eq!(shadow(&s, c), shadow(&s, a));
+
+ // Saved and opened again, the style keeps its effects.
+ let bytes = s.execute("file.serialize", &json!({})).unwrap();
+ let mut back = Session::new();
+ back.execute("file.openBytes", &json!({"name": "copy", "base64": bytes["base64"]})).unwrap();
+ let d = &back.doc().unwrap().doc;
+ assert_eq!(d.styles.object_style("Photo").unwrap().effects.as_ref().unwrap().drop_shadow.size, 20.0);
+ assert!(d.styles.object_style(BASIC_GRAPHICS_FRAME).unwrap().effects.is_none());
+
+ s.execute("edit.undo", &json!({})).unwrap();
+ assert_eq!(shadow(&s, c).size, 30.0);
+ s.execute("edit.undo", &json!({})).unwrap();
+ assert_eq!((shadow(&s, a).size, shadow(&s, b).size), (12.0, 12.0));
+ assert_eq!(s.doc().unwrap().doc.styles.object_style("Photo").unwrap().effects.as_ref().unwrap().drop_shadow.size, 12.0);
+
+ // A style that didn't set effects gives them to every item using it; `null` stops setting them.
+ let e = frame(&mut s, 36.0);
+ s.execute("style.object.apply", &json!({"name": BASIC_GRAPHICS_FRAME, "ids": [e]})).unwrap();
+ s.execute("object.dropShadow", &json!({"on": true, "ids": [e]})).unwrap();
+ s.execute("style.object.edit", &json!({"name": BASIC_GRAPHICS_FRAME, "feather": 4})).unwrap();
+ assert_eq!(item(&s, e).effects, designcraft_doc::Effects { feather: 4.0, ..Default::default() });
+ s.execute("style.object.edit", &json!({"name": BASIC_GRAPHICS_FRAME, "effects": null})).unwrap();
+ assert!(s.doc().unwrap().doc.styles.object_style(BASIC_GRAPHICS_FRAME).unwrap().effects.is_none());
+ assert_eq!(item(&s, e).effects.feather, 4.0);
+ assert!(s.execute("style.object.edit", &json!({"name": "Photo", "dropShadow": {"size": "big"}})).is_err());
+}
+
/// Unicode text per page, through hayro's interpreter (ToUnicode / ActualText).
fn pdf_text(bytes: &[u8]) -> Vec<String> {
use hayro_interpret::font::Glyph;
diff --git a/crates/idml/src/export.rs b/crates/idml/src/export.rs
index 9d73562b9..5a44dfe19 100644
--- a/crates/idml/src/export.rs
+++ b/crates/idml/src/export.rs
@@ -1034,9 +1034,31 @@ impl<'a> Ex<'a> {
el.set("AppliedParagraphStyle", names::style_self("ParagraphStyle", PARA_BUILTINS, ps));
}
let mut el = with_props(el, props);
+ if let Some(e) = &os.effects {
+ let mut t = El::new("TransparencySetting");
+ for c in self.effect_els(e, true) {
+ t.push(c);
+ }
+ el.push(t);
+ }
if let Some(tf) = &os.text_frame {
el.push(text_frame_pref(tf, &self.sw(&tf.column_rule_color)));
}
+ // Effects: a style with effects sets the drop shadow and feather, never blending.
+ let on = bool_s(os.effects.is_some());
+ el.push(
+ El::new("ObjectStyleObjectEffectsCategorySettings")
+ .attr("EnableTransparency", "false")
+ .attr("EnableDropShadow", on)
+ .attr("EnableFeather", on)
+ .attr("EnableInnerShadow", "false")
+ .attr("EnableOuterGlow", "false")
+ .attr("EnableInnerGlow", "false")
+ .attr("EnableBevelEmboss", "false")
+ .attr("EnableSatin", "false")
+ .attr("EnableDirectionalFeather", "false")
+ .attr("EnableGradientFeather", "false"),
+ );
og.insert(&os.name, el);
}
let mut ro = El::new("RootObjectStyleGroup").attr("Self", self.fresh());
@@ -1686,21 +1708,8 @@ impl<'a> Ex<'a> {
if it.opacity < 1.0 || it.blend != designcraft_color::BlendMode::Normal || ds.on || it.effects.feather > 0.0 {
let mut t = El::new("TransparencySetting");
t.push(El::new("BlendingSetting").attr("BlendMode", names::blend_out(it.blend)).attr("Opacity", pct(it.opacity as f64)));
- if ds.on {
- let a = self.d.light_angle(ds.angle, ds.global_light).to_radians();
- t.push(
- El::new("DropShadowSetting")
- .attr("Mode", "Drop")
- .attr("XOffset", num(-ds.distance * a.cos()))
- .attr("YOffset", num(ds.distance * a.sin()))
- .attr("Size", num(ds.size))
- .attr("Spread", num(ds.spread))
- .attr("Opacity", pct(ds.opacity as f64))
- .attr("EffectColor", self.sw(&ds.color)),
- );
- }
- if it.effects.feather > 0.0 {
- t.push(El::new("FeatherSetting").attr("Mode", "Standard").attr("Width", num(it.effects.feather)));
+ for c in self.effect_els(&it.effects, false) {
+ t.push(c);
}
el.push(t);
}
@@ -1760,6 +1769,30 @@ impl<'a> Ex<'a> {
el
}
+ /// The `TransparencySetting` children for `e`'s drop shadow and feather; `all` also writes the
+ /// effects that are off (`Mode="None"`), as an object style that sets effects does.
+ fn effect_els(&self, e: &designcraft_doc::Effects, all: bool) -> Vec<El> {
+ let mut out = Vec::new();
+ let ds = &e.drop_shadow;
+ if ds.on || all {
+ let a = self.d.light_angle(ds.angle, ds.global_light).to_radians();
+ out.push(
+ El::new("DropShadowSetting")
+ .attr("Mode", if ds.on { "Drop" } else { "None" })
+ .attr("XOffset", num(-ds.distance * a.cos()))
+ .attr("YOffset", num(ds.distance * a.sin()))
+ .attr("Size", num(ds.size))
+ .attr("Spread", num(ds.spread))
+ .attr("Opacity", pct(ds.opacity as f64))
+ .attr("EffectColor", self.sw(&ds.color)),
+ );
+ }
+ if e.feather > 0.0 || all {
+ out.push(El::new("FeatherSetting").attr("Mode", if e.feather > 0.0 { "Standard" } else { "None" }).attr("Width", num(e.feather)));
+ }
+ out
+ }
+
fn image_el(&mut self, asset: &designcraft_doc::Asset, g: &designcraft_doc::Graphic) -> El {
let is_pdf = asset.mime == "application/pdf";
let mut el = El::new(if is_pdf { "PDF" } else { "Image" }).attr("Self", self.fresh());
diff --git a/crates/idml/src/import.rs b/crates/idml/src/import.rs
index 46c3253b6..93fbe375a 100644
--- a/crates/idml/src/import.rs
+++ b/crates/idml/src/import.rs
@@ -983,7 +983,8 @@ impl<'r> Importer<'r> {
} else {
None
};
- let s = ObjectStyle { name: name.clone(), based_on, fill, stroke, paragraph_style, text_frame };
+ let effects = self.style_effects(e);
+ let s = ObjectStyle { name: name.clone(), based_on, fill, stroke, paragraph_style, text_frame, effects };
match self.styles.object.iter_mut().find(|o| o.name == name) {
Some(slot) => *slot = s,
None => self.styles.object.push(s),
@@ -2008,6 +2009,53 @@ impl<'r> Importer<'r> {
None
}
+ /// Reads the drop shadow and feather of a `TransparencySetting` into `fx`.
+ fn effects_in(&mut self, t: &El, fx: &mut Effects) {
+ if let Some(ds) = t.find("DropShadowSetting")
+ && ds.get("Mode") == Some("Drop")
+ {
+ let x = ds.num("XOffset").unwrap_or(4.95);
+ let y = ds.num("YOffset").unwrap_or(4.95);
+ let def = DropShadow::default();
+ fx.drop_shadow = DropShadow {
+ on: true,
+ color: ds.get("EffectColor").map(|c| self.swatch_ref(c)).unwrap_or(def.color),
+ opacity: ds.num("Opacity").map(|o| (o / 100.0) as f32).unwrap_or(def.opacity),
+ angle: names_angle(x, y),
+ distance: x.hypot(y),
+ size: ds.num("Size").unwrap_or(def.size),
+ spread: ds.num("Spread").unwrap_or(def.spread),
+ global_light: false,
+ };
+ }
+ if let Some(f) = t.find("FeatherSetting")
+ && f.get("Mode").is_some_and(|m| m != "None")
+ {
+ fx.feather = f.num("Width").unwrap_or(9.0);
+ }
+ }
+
+ /// An object style's effects: set when its effects category turns on an effect this model
+ /// reads, or (without category settings) when it gives a drop shadow or feather that is on.
+ fn style_effects(&mut self, e: &El) -> Option<Effects> {
+ let t = e.find("TransparencySetting");
+ let set = match e.find("ObjectStyleObjectEffectsCategorySettings") {
+ Some(c) => ["EnableDropShadow", "EnableFeather"].iter().any(|k| c.get(k) == Some("true")),
+ None => t.is_some_and(|t| {
+ t.find("DropShadowSetting").is_some_and(|d| d.get("Mode") == Some("Drop"))
+ || t.find("FeatherSetting").is_some_and(|f| f.get("Mode").is_some_and(|m| m != "None"))
+ }),
+ };
+ if !set {
+ return None;
+ }
+ let mut fx = Effects::default();
+ if let Some(t) = t {
+ self.effects_in(t, &mut fx);
+ }
+ Some(fx)
+ }
+
fn stroke_from(&mut self, e: &El, item: Option<&El>) -> Stroke {
let g = |s: &Self, k: &str| -> Option<String> { if item.is_some() { s.attr_or_style(e, k) } else { e.get(k).map(str::to_string) } };
let color = g(self, "StrokeColor");
@@ -2135,28 +2183,7 @@ impl<'r> Importer<'r> {
it.blend = names::blend_in(m);
}
}
- if let Some(ds) = t.find("DropShadowSetting")
- && ds.get("Mode") == Some("Drop")
- {
- let x = ds.num("XOffset").unwrap_or(4.95);
- let y = ds.num("YOffset").unwrap_or(4.95);
- let def = DropShadow::default();
- it.effects.drop_shadow = DropShadow {
- on: true,
- color: ds.get("EffectColor").map(|c| self.swatch_ref(c)).unwrap_or(def.color),
- opacity: ds.num("Opacity").map(|o| (o / 100.0) as f32).unwrap_or(def.opacity),
- angle: names_angle(x, y),
- distance: x.hypot(y),
- size: ds.num("Size").unwrap_or(def.size),
- spread: ds.num("Spread").unwrap_or(def.spread),
- global_light: false,
- };
- }
- if let Some(f) = t.find("FeatherSetting")
- && f.get("Mode").is_some_and(|m| m != "None")
- {
- it.effects = Effects { feather: f.num("Width").unwrap_or(9.0), ..it.effects.clone() };
- }
+ self.effects_in(t, &mut it.effects);
}
// Text wrap.
if let Some(w) = e.find("TextWrapPreference") {
diff --git a/crates/idml/src/tests.rs b/crates/idml/src/tests.rs
index 23ec99bdf..ba3d4c714 100644
--- a/crates/idml/src/tests.rs
+++ b/crates/idml/src/tests.rs
@@ -1454,3 +1454,34 @@ fn list_numbering_format_expression_and_bullet_import_and_round_trip() {
check(&d);
check(&import_idml(&export_idml(&d)).unwrap());
}
+
+#[test]
+fn object_style_effects_round_trip() {
+ use designcraft_doc::{DropShadow, Effects, ObjectStyle};
+ let mut d = Document::new(&NewDocument::default());
+ let fx = Effects {
+ drop_shadow: DropShadow { on: true, distance: 5.0, size: 12.0, opacity: 0.28, ..Default::default() },
+ feather: 3.0,
+ ..Default::default()
+ };
+ d.styles_mut().object.push(ObjectStyle { name: "Photo".into(), effects: Some(fx.clone()), ..Default::default() });
+ d.styles_mut().object.push(ObjectStyle { name: "Plain".into(), fill: Some(Fill::swatch("Black")), ..Default::default() });
+ let lid = d.default_layer();
+ let id = designcraft_doc::ItemId(d.alloc());
+ let mut it = designcraft_doc::Item::new(id, lid, Shape::Rectangle, shapes::rectangle(Rect::new(40.0, 40.0, 140.0, 140.0)));
+ it.object_style = "Photo".into();
+ it.effects = fx.clone();
+ d.insert_item(SpreadRef::Doc(0), it, None).unwrap();
+
+ let back = import_idml(&export_idml(&d)).unwrap();
+ let style = |n: &str| back.styles.object.iter().find(|s| s.name == n).unwrap();
+ let got = style("Photo").effects.clone().unwrap();
+ let ds = &got.drop_shadow;
+ assert!(ds.on && ds.size == 12.0 && (ds.opacity - 0.28).abs() < 1e-6, "{ds:?}");
+ assert!((ds.distance - 5.0).abs() < 1e-6 && (ds.angle - 135.0).abs() < 1e-6, "{ds:?}");
+ assert_eq!(got.feather, 3.0);
+ assert!(style("Plain").effects.is_none());
+ // The frame's effects are the style's, so it follows later edits of the style.
+ let frame = back.spreads[0].items.iter().find(|i| i.object_style == "Photo").unwrap();
+ assert_eq!(frame.effects, got);
+}
diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md
index 78e968dcf..4f1421671 100644
--- a/docs/target-app-parity.md
+++ b/docs/target-app-parity.md
@@ -1,6 +1,6 @@
# DesignCraft parity with Adobe InDesign
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (cancelable macOS Dock Quit) · **Target:** Adobe InDesign 2026 (21.6.0.57, macOS)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-13 · **Change:** minor (object styles carry effects) · **Target:** Adobe InDesign 2026 (21.6.0.57, macOS)
The authoritative assessment of how close DesignCraft is to Adobe InDesign. [ROADMAP.md](../ROADMAP.md)
summarizes it; [gaps.md](gaps.md) lists every known shortfall one at a time; the feature-by-feature
@@ -401,6 +401,7 @@ It is evidence of breadth: each item exists. It is not a claim of InDesign-level
- Nested styles (through/up to N sentences, words, characters, letters, digits, tabs, breaks, spaces or given characters) and GREP styles (regex → character style), edited in Paragraph Style Options and composed under local formatting; `ui.dialog.open` for agents. Nested line styles are still to come; nested and GREP styles round-trip through IDML.
- Table and cell styles (round-trip through IDML): cell styles (fill, insets, vertical justification, strokes, paragraph style) and table styles (region cell styles, border, alternating rows, spacing); apply from the Table panel, edits re-apply to every user; `style.cell.*`, `style.table.*`.
- Style groups: paragraph and character styles shown in group folders, Move to Group (new, existing, none); `style.group` renames every use (styles, stories, table cells, footnotes, object styles).
+- Object styles carry effects: `style.object.create` keeps the selection's effects, `style.object.apply` sets them, and `style.object.edit {name, dropShadow?, feather?, …, effects?: null}` changes them on the style and on every item whose effects still match it (items with their own effects keep them; `style.object.clearOverrides` returns them to the style). IDML ObjectStyles carry the drop shadow and feather. There is no Object Style Options dialog yet.
- Scrubby zoom: drag the Zoom tool left or right to zoom continuously around the press point.
- Guides belong to the active layer: hidden with it (or with its Show Guides off) and locked with it.
- Pencil tool (N): freehand strokes simplified to smooth paths (Alt closes); Smooth and Erase tools re-fit or remove the stretch you drag along (`path.smooth`, `path.erase`).