Merge pull request #2143 from TrevorBrown-dev/feat/annotation-tool-1840

Developer Mode: Shift+T picks the Annotation tool, which opens a layer's note (#1840)
This commit is contained in:
BFlat
2026-11-12 11:01:02 +07:00
committed by GitHub
19 changed files with 236 additions and 14 deletions
+10 -1
View File
@@ -58,6 +58,7 @@ pub enum ToolId {
Text,
TextOnPath,
Comment,
Annotation,
Eyedropper,
ShapeBuilder,
// Board tools.
@@ -71,7 +72,7 @@ pub enum ToolId {
}
impl ToolId {
pub const ALL: [ToolId; 26] = [
pub const ALL: [ToolId; 27] = [
ToolId::Move,
ToolId::Scale,
ToolId::Hand,
@@ -89,6 +90,7 @@ impl ToolId {
ToolId::Text,
ToolId::TextOnPath,
ToolId::Comment,
ToolId::Annotation,
ToolId::Eyedropper,
ToolId::ShapeBuilder,
ToolId::Sticky,
@@ -118,6 +120,7 @@ impl ToolId {
ToolId::Text => "text",
ToolId::TextOnPath => "textOnPath",
ToolId::Comment => "comment",
ToolId::Annotation => "annotation",
ToolId::Eyedropper => "eyedropper",
ToolId::ShapeBuilder => "shapeBuilder",
ToolId::Sticky => "sticky",
@@ -129,6 +132,11 @@ impl ToolId {
ToolId::Stamp => "stamp",
}
}
/// Whether Developer Mode keeps this tool: it only inspects, so the tools that edit leave it.
/// The one list behind the engine's pointer routing and command allowlist and the toolbar.
pub fn works_in_dev_mode(self) -> bool {
matches!(self, ToolId::Move | ToolId::Hand | ToolId::Comment | ToolId::Annotation)
}
pub fn from_id(s: &str) -> Option<ToolId> {
ToolId::ALL.into_iter().find(|t| t.id().eq_ignore_ascii_case(s))
}
@@ -151,6 +159,7 @@ impl ToolId {
ToolId::Text => "Text",
ToolId::TextOnPath => "Text on a path",
ToolId::Comment => "Comment",
ToolId::Annotation => "Annotation",
ToolId::Eyedropper => "Pick color",
ToolId::ShapeBuilder => "Shape builder",
ToolId::Sticky => "Sticky note",
+15 -1
View File
@@ -110,7 +110,7 @@ impl Session {
/// The tool pointer events go to: in Dev Mode every tool but the hand and comments selects.
fn acting_tool(&self) -> ToolId {
match self.tool.tool {
t if self.tool.dev_mode && !matches!(t, ToolId::Hand | ToolId::Comment) => ToolId::Move,
t if self.tool.dev_mode && !t.works_in_dev_mode() => ToolId::Move,
t => t,
}
}
@@ -176,6 +176,7 @@ impl Session {
self.request_ui("comment.new", json!({"x": ev.x, "y": ev.y}));
Ok(())
}
ToolId::Annotation => self.annotation_down(ev),
ToolId::Eyedropper => self.eyedrop(ev),
t if t.on_boards() => self.board_down(ev),
t if t.draws_shape() => self.draw_down(ev),
@@ -206,6 +207,19 @@ impl Session {
Ok(true)
}
/// The Annotation tool's press: the layer under the pointer is selected and the UI is asked
/// for its note (the engine writes nothing; the note is typed in the Inspect tab). A press on
/// empty canvas does nothing.
fn annotation_down(&mut self, ev: &PointerEvent) -> Result<()> {
let ds = self.ds()?;
let (doc, page) = (ds.doc.clone(), ds.page);
// The same reach as the Move tool's pick (`ev.tol() * 2.0`); never the page itself.
let Some(id) = self.hit(&doc, page, ev.p(), ev.tol() * 2.0).filter(|i| doc.node(*i).is_some_and(|n| !n.is_page())) else { return Ok(()) };
self.set_selection(vec![id]);
self.request_ui("annotation.new", json!({"id": id}));
Ok(())
}
pub(super) fn hover(&mut self, ev: &PointerEvent) -> Result<()> {
let tool = self.acting_tool();
let ds = self.ds()?;
+1
View File
@@ -291,6 +291,7 @@ pub static MENU: &[MenuItem] = &[
m!("Tools", "Pencil", "tool.pencil"),
m!("Tools", "Text", "tool.text"),
m!("Tools", "Comment", "tool.comment"),
m!("Tools", "Annotation", "tool.annotation"),
m!("Tools", "Shape builder", "tool.shapeBuilder"),
m!("Tools", "Actions", "app.actions"),
];
+27 -1
View File
@@ -235,6 +235,26 @@ pub(crate) fn tool(s: &mut Session, t: ToolId) -> Result<Value> {
Ok(json!({"tool": t.id()}))
}
/// Shift+T and choosing the Annotation tool: with a layer selected (or named by `id`/`ids`) the UI
/// is asked for its note at once; in the tool, a press on a layer selects it and asks (the engine
/// never writes the note). A named target is checked first: one that isn't a layer in the document
/// is an error and the tool stays as it was.
fn annotation(s: &mut Session, p: &Value) -> Result<Value> {
let named = p.get("id").is_some_and(|v| !v.is_null()) || p.get("ids").is_some_and(|v| !v.is_null());
let first = crate::params::targets(s, p).into_iter().find(|i| s.doc().is_ok_and(|d| d.node(*i).is_some_and(|n| !n.is_page())));
if named && first.is_none() {
return Err(bad("tool.annotation", "`id` must name a layer in this document (not a page)".to_string()));
}
let r = tool(s, ToolId::Annotation)?;
if let Some(id) = first {
if named {
crate::cmd::edit::select_and_page(s, vec![id])?;
}
s.request_ui("annotation.new", json!({"id": id}));
}
Ok(r)
}
/// The View menu's commands and their parameters.
pub fn specs() -> Vec<CommandSpec> {
vec![
@@ -528,7 +548,7 @@ pub fn specs() -> Vec<CommandSpec> {
spec!(
"tool.set",
"Choose tool",
"{tool: move|scale|hand|frame|section|slice|rectangle|line|arrow|ellipse|polygon|star|pen|pencil|text|comment|shapeBuilder | on boards: sticky|shape|connector|marker|highlighter|eraser|stamp}",
"{tool: move|scale|hand|frame|section|slice|rectangle|line|arrow|ellipse|polygon|star|pen|pencil|text|comment|annotation|shapeBuilder | on boards: sticky|shape|connector|marker|highlighter|eraser|stamp}",
false,
|s, p| {
let t = req_string("tool.set", p, "tool")?;
@@ -536,6 +556,9 @@ pub fn specs() -> Vec<CommandSpec> {
if t.on_boards() {
crate::board::require(s, &format!("tool.{}", t.id()))?;
}
if t == ToolId::Annotation {
return annotation(s, &json!({}));
}
tool(s, t)
}
),
@@ -638,6 +661,9 @@ pub fn specs() -> Vec<CommandSpec> {
tool(s, ToolId::TextOnPath)
}),
spec!("tool.comment", "Comment", "{}", false, |s, _| tool(s, ToolId::Comment)),
// Shift+T: with a layer selected (or an `id`) the UI is asked for its note at once; in the
// tool, a press on a layer selects it and asks (the engine never writes the note).
spec!("tool.annotation", "Annotation", "{id?|ids?}", false, annotation),
spec!("tool.shapeBuilder", "Shape builder", "{}", false, |s, _| tool(s, ToolId::ShapeBuilder)),
// `apply: false` is for the UI colour picker: the eyedropper only samples (into
// `ToolState::picked`) and the picker writes the colour to the paint it edits.
+1
View File
@@ -107,6 +107,7 @@ fn each_tool_has_its_cursor_by_modifier_and_what_is_under_the_pointer() {
(ToolId::TextOnPath, NONE, ON_SQUARE_EDGE, Text, "the I-beam over a shape's path: a click puts text on it"),
(ToolId::Pen, NONE, EMPTY, Pen(PenCursor::New), "the pen: a new point"),
(ToolId::Comment, NONE, EMPTY, Comment, "the comment pin"),
(ToolId::Annotation, NONE, ON_SQUARE, Crosshair, "the annotation tool marks the layer it is pressed on"),
(ToolId::Eyedropper, NONE, ON_SQUARE, Eyedropper, "the eyedropper"),
];
for (tool, m, at, want, why) in rows {
+1 -1
View File
@@ -230,7 +230,7 @@ pub fn dev_mode_allows(id: &str) -> bool {
// Edits recorded as one grouped undo step, so their spec says no history of its own.
const GROUPED: [&str; 1] = ["data.fill"];
match id.strip_prefix("tool.") {
Some(t) => matches!(t, "move" | "hand" | "comment"),
Some(t) => crate::tools::ToolId::from_id(t).is_some_and(crate::tools::ToolId::works_in_dev_mode),
None if id == "file.revert" || GROUPED.contains(&id) => false,
None => OWN.iter().any(|p| id.starts_with(p)) || crate::cmd::find_command(id).is_none_or(|c| !c.history),
}
@@ -99,6 +99,102 @@ fn the_dev_mode_canvas_selects_and_pans_but_never_edits() {
assert!(s.doc().unwrap().node(r).is_some_and(|n| n.transform.as_coeffs()[4] > 100.0), "moved");
}
/// The `annotation.new` requests queued so far, as the layer ids they name.
fn note_requests(s: &Session) -> Vec<NodeId> {
s.ui_requests.iter().filter(|r| r.kind == "annotation.new").filter_map(|r| crate::params::id_of(&r.data["id"])).collect()
}
fn click(s: &mut Session, x: f64, y: f64) {
s.pointer(&ev(PointerKind::Down, x, y)).unwrap();
s.pointer(&ev(PointerKind::Up, x, y)).unwrap();
}
#[test]
fn the_annotation_tool_picks_a_layer_and_asks_for_its_note() {
for dev_mode in [true, false] {
let mut s = Session::new();
let f = frame(&mut s, 0.0, "Screen");
let r = rect(&mut s, f, 20.0);
s.tool.dev_mode = dev_mode;
ex(&mut s, "select.set", json!({"ids": []}));
ex(&mut s, "tool.annotation", json!({}));
assert_eq!(s.tool.tool, ToolId::Annotation);
assert!(note_requests(&s).is_empty(), "nothing selected: no note is asked for yet");
let (doc_before, undo_before) = (s.doc().unwrap().clone(), s.undo_labels(1000).len());
// A press on empty canvas does nothing.
click(&mut s, 1000.0, 1000.0);
assert!(note_requests(&s).is_empty(), "empty canvas asks for nothing (dev_mode {dev_mode})");
// A press on the rectangle selects it and asks for its note.
click(&mut s, 40.0, 40.0);
assert_eq!(s.selection(), vec![r], "dev_mode {dev_mode}");
assert_eq!(note_requests(&s), vec![r], "dev_mode {dev_mode}");
assert_eq!(s.tool.tool, ToolId::Annotation, "the tool stays until V or Escape");
// The tool writes nothing.
assert_eq!(*s.doc().unwrap(), doc_before);
assert_eq!(s.undo_labels(1000).len(), undo_before);
}
// The keyboard flow: with a layer selected, choosing the tool asks at once.
let mut s = Session::new();
let f = frame(&mut s, 0.0, "Screen");
let r = rect(&mut s, f, 20.0);
ex(&mut s, "select.set", json!({"ids": [r]}));
ex(&mut s, "tool.annotation", json!({}));
assert_eq!(note_requests(&s), vec![r]);
// And with an `id`.
let mut s = Session::new();
let f = frame(&mut s, 0.0, "Screen");
let r = rect(&mut s, f, 20.0);
ex(&mut s, "tool.annotation", json!({"id": r}));
assert_eq!(note_requests(&s), vec![r]);
assert_eq!(s.selection(), vec![r]);
}
/// A named target that isn't a layer (a page, an unknown id) is an error, and the tool is left as it
/// was; several targets pick the first layer among them and select it.
#[test]
fn the_annotation_tool_checks_the_layer_it_is_named_for_before_changing_anything() {
let mut s = Session::new();
let f = frame(&mut s, 0.0, "Screen");
let r = rect(&mut s, f, 20.0);
let page = s.page().unwrap();
assert!(s.execute("tool.annotation", &json!({"id": page})).is_err(), "a page is not a layer");
assert!(s.execute("tool.annotation", &json!({"id": "9999:9999"})).is_err(), "no such layer");
assert!(s.execute("tool.annotation", &json!({"ids": []})).is_err(), "nothing named");
assert_eq!(s.tool.tool, ToolId::Move, "the tool did not change");
assert!(note_requests(&s).is_empty());
// The page first, then the rectangle: the rectangle is the target, and selected.
ex(&mut s, "tool.annotation", json!({"ids": [page, r]}));
assert_eq!((s.tool.tool, s.selection(), note_requests(&s)), (ToolId::Annotation, vec![r], vec![r]));
}
/// Choosing the tool with `tool.set` (the toolbar) asks for the selected layer's note like Shift+T.
#[test]
fn choosing_the_annotation_tool_from_the_toolbar_asks_for_the_selected_layers_note() {
let mut s = Session::new();
let f = frame(&mut s, 0.0, "Screen");
let r = rect(&mut s, f, 20.0);
ex(&mut s, "select.set", json!({"ids": [r]}));
ex(&mut s, "tool.set", json!({"tool": "annotation"}));
assert_eq!((s.tool.tool, note_requests(&s)), (ToolId::Annotation, vec![r]));
}
/// A drag with the tool never moves the layer it starts on, in Developer Mode or out of it.
#[test]
fn dragging_with_the_annotation_tool_moves_nothing() {
for dev_mode in [true, false] {
let mut s = Session::new();
let f = frame(&mut s, 0.0, "Screen");
rect(&mut s, f, 20.0);
s.tool.dev_mode = dev_mode;
ex(&mut s, "select.set", json!({"ids": []}));
ex(&mut s, "tool.annotation", json!({}));
let (doc_before, undo_before) = (s.doc().unwrap().clone(), s.undo_labels(1000).len());
drag(&mut s, (40.0, 40.0), (140.0, 90.0));
assert_eq!(*s.doc().unwrap(), doc_before, "dev_mode {dev_mode}");
assert_eq!(s.undo_labels(1000).len(), undo_before, "dev_mode {dev_mode}");
}
}
#[test]
fn dev_mode_runs_its_own_edits_and_refuses_design_edits_from_menus_and_shortcuts() {
for id in [
@@ -121,6 +217,7 @@ fn dev_mode_runs_its_own_edits_and_refuses_design_edits_from_menus_and_shortcuts
"tool.move",
"tool.hand",
"tool.comment",
"tool.annotation",
"inspect.code",
] {
assert!(dev_mode_allows(id), "{id} runs in Dev Mode");
+1
View File
@@ -192,6 +192,7 @@ pub static KEYS: &[Binding] = &[
k(Tools, "tool.pencil", &["Shift+P"]),
k(Tools, "tool.text", &["T"]),
k(Tools, "tool.comment", &["C"]),
k(Tools, "tool.annotation", &["Shift+T"]),
k(Tools, "tool.shapeBuilder", &["Shift+M"]),
// Board tools (on boards only), on keys nothing else uses.
k(Tools, "tool.sticky", &["Q"]),
+2
View File
@@ -206,6 +206,8 @@ fn tool_keys_come_from_the_keymap() {
assert_eq!(ToolId::Eyedropper.shortcut(), "I");
assert_eq!(ToolId::Polygon.shortcut(), "");
assert_eq!(crate::catalog::shortcut("tool.text"), Some("T"));
assert_eq!(ToolId::Annotation.shortcut(), "Shift+T");
assert_eq!(crate::catalog::shortcut("tool.annotation"), Some("Shift+T"));
}
#[test]
+2 -1
View File
@@ -110,6 +110,7 @@ static ROWS: &[Row] = &[
doc(Tools, "Pencil tool", &["Shift+P"], &[], Bound("tool.pencil"), ""),
doc(Tools, "Text tool", &["T"], &[], Bound("tool.text"), ""),
doc(Tools, "Comment mode", &["C"], &[], Bound("tool.comment"), ""),
doc(Tools, "Annotation tool", &["Shift+T"], &[], Bound("tool.annotation"), "Accessibility at Figma, Add an annotation; Developer Mode"),
doc(Tools, "Hand tool while held", &["Space"], &[], Gesture("Pan the canvas"), "held, not pressed"),
doc(Tools, "Pan with the arrows when nothing is selected (Shift: farther)", &["ArrowRight"], &[], Gesture("Pan with nothing selected (Shift: farther)"),
"view.pan; nudges move the selection when there is one"),
@@ -416,7 +417,7 @@ fn counts_match_the_docs() {
let reserved = documented.iter().filter(|r| !r.reserved.is_empty()).count();
let pinned = ROWS.len() - documented.len();
// docs/ui-parity.md quotes these.
assert_eq!((documented.len(), bound, moved, missing, reserved, pinned), (136, 135, 1, 0, 2, 57));
assert_eq!((documented.len(), bound, moved, missing, reserved, pinned), (137, 136, 1, 0, 2, 57));
}
#[test]
+1 -1
View File
@@ -336,7 +336,7 @@ fn tools() -> Vec<Value> {
"y": num("Page y"),
"to": {"type": "array", "items": {"type": "number"}, "minItems": 2, "maxItems": 2, "description": "Drag end [x, y] (page)"},
"steps": int("Intermediate move events for drag (default 8)"),
"tool": {"type": "string", "description": "Tool to choose first: move|scale|hand|frame|section|slice|rectangle|line|arrow|ellipse|polygon|star|pen|pencil|text|comment"},
"tool": {"type": "string", "description": "Tool to choose first: move|scale|hand|frame|section|slice|rectangle|line|arrow|ellipse|polygon|star|pen|pencil|text|comment|annotation"},
"shift": boolean("Shift held"),
"alt": boolean("Alt/Option held"),
"cmd": boolean("Cmd (macOS) / Ctrl held"),
+1
View File
@@ -122,6 +122,7 @@ name = "English"
"Android Vector Drawable" = "Android Vector Drawable"
"Angular" = "Angular"
"Animation" = "Animation"
"Annotation" = "Annotation"
"Annotations" = "Annotations"
"Annotations shown on the canvas" = "Annotations shown on the canvas"
"Another server, or one that needs its key. The usual server is set in Preferences." = "Another server, or one that needs its key. The usual server is set in Preferences."
+2
View File
@@ -22,6 +22,7 @@ status = "draft — needs native review"
"Along the top" = "A lo largo del borde superior"
"An earlier vote" = "Una votación anterior"
"Android Vector Drawable" = "Android Vector Drawable"
"Annotation" = "Anotación"
"Best effort" = "Mejor aproximación"
"Between the selected layers" = "Entre las capas seleccionadas"
"Brainstorm" = "Lluvia de ideas"
@@ -2366,6 +2367,7 @@ status = "draft — needs native review"
"text.underline" = "Subrayado"
"text.weightDown" = "Reducir peso de fuente"
"text.weightUp" = "Aumentar peso de fuente"
"tool.annotation" = "Anotación"
"tool.arrow" = "Flecha"
"tool.comment" = "Comentario"
"tool.connector" = "Conector"
+12
View File
@@ -266,6 +266,18 @@ impl FigApp {
self.ui.comments.show(id);
}
}
"annotation.new" => {
// The Annotation tool: show the Inspect tab (never toggle it away) and put the
// caret in the layer's new-note field.
// Only a selected layer's field can show; a request for anything else would wait
// and take the keyboard later.
let shown =
|id| self.session.selection().contains(&id) && self.session.doc().is_ok_and(|d| d.node(id).is_some_and(|n| !n.is_page()));
if let Some(id) = r.data.get("id").and_then(figcraft_engine::params::id_of).filter(|id| shown(*id)) {
self.ui.right_tab = RightTab::Inspect;
self.ui.dev.focus_new_note = Some(id);
}
}
"comment.new" => {
let x = r.data.get("x").and_then(|v| v.as_f64()).unwrap_or(0.0);
let y = r.data.get("y").and_then(|v| v.as_f64()).unwrap_or(0.0);
+44
View File
@@ -196,3 +196,47 @@ fn the_playground_swaps_an_instance_in_the_preview_only() {
let props = u.app.session.execute("component.properties", &json!({"id": inst})).unwrap();
assert_eq!(props["properties"][0]["value"], json!(heart.0), "{star:?}");
}
#[test]
fn the_annotation_tool_opens_the_inspect_tab_with_the_note_field_focused() {
let (mut u, _, r) = setup();
u.app.ui.right_tab = crate::RightTab::Design;
u.frames(2, Vec::new);
u.run("tool.annotation", json!({"id": r}));
u.frames(2, Vec::new);
assert_eq!(u.app.ui.right_tab, crate::RightTab::Inspect, "the request shows the Inspect tab");
let field = egui::Id::unique(("annot_new", r)).with("te");
assert!(u.ctx.memory(|m| m.has_focus(field)), "the layer's new-note field has the caret");
assert_eq!(u.app.ui.dev.focus_new_note, None, "the focus request is spent");
// Asking again while already on the Inspect tab does not toggle it away.
u.run("tool.annotation", json!({"id": r}));
u.frames(2, Vec::new);
assert_eq!(u.app.ui.right_tab, crate::RightTab::Inspect);
assert!(u.ctx.memory(|m| m.has_focus(field)), "the field has the caret again");
assert_eq!(u.app.ui.dev.focus_new_note, None, "and the request is spent");
}
/// A request for a layer that isn't selected (or is gone) does not wait to take the keyboard later.
#[test]
fn a_note_request_for_a_layer_that_is_not_selected_is_dropped() {
let (mut u, _, r) = setup();
u.app.session.execute("select.set", &json!({"ids": []})).unwrap();
u.frames(2, Vec::new);
u.app.session.request_ui("annotation.new", json!({"id": r}));
u.frames(2, Vec::new);
assert_eq!(u.app.ui.dev.focus_new_note, None);
}
/// Choosing the Annotation tool from the toolbar on the Inspect tab keeps the tab (an editing tool
/// would leave it for Design) and asks for the selected layer's note.
#[test]
fn the_toolbar_keeps_the_inspect_tab_for_the_annotation_tool() {
let (mut u, _, r) = setup();
u.app.session.execute("select.set", &json!({"ids": [r]})).unwrap();
crate::toolbar::choose(&mut u.app, figcraft_engine::ToolId::Annotation);
u.frames(2, Vec::new);
assert_eq!(u.app.ui.right_tab, crate::RightTab::Inspect);
assert!(u.ctx.memory(|m| m.has_focus(egui::Id::unique(("annot_new", r)).with("te"))), "the note field has the caret");
crate::toolbar::choose(&mut u.app, figcraft_engine::ToolId::Rectangle);
assert_eq!(u.app.ui.right_tab, crate::RightTab::Design, "a drawing tool leaves it");
}
+8
View File
@@ -92,6 +92,9 @@ impl CategoryFilter {
/// revision), the page or the choice change.
#[derive(Default)]
pub struct DevUi {
/// The layer whose new-note field takes the keyboard focus once its section draws (the
/// Annotation tool asked for that layer's note).
pub focus_new_note: Option<NodeId>,
pub filter: usize,
pub categories: CategoryFilter,
pub compare: Option<crate::dev_compare::CompareView>,
@@ -618,6 +621,11 @@ pub fn annotations_section(app: &mut FigApp, ui: &mut Ui, doc: &Document, id: No
}
ui.add_space(6.0);
}
// The Annotation tool asked for this layer's note: put the caret in the new-note field, once.
if app.ui.dev.focus_new_note == Some(id) {
app.ui.dev.focus_new_note = None;
ui.memory_mut(|m| m.request_focus(Id::unique(("annot_new", id)).with("te")));
}
// A new annotation starts as a note; properties are pinned to it afterwards.
if n.annotations.len() < annotations::MAX_PER_LAYER
&& let Some(label) = widgets::multiline_field(ui, Id::unique(("annot_new", id)), "", tr("Add an annotation for developers"), 1)
+2 -2
View File
@@ -626,8 +626,8 @@ fn flyout(app: &mut FigApp, ui: &mut Ui, g: &Group, bottom_left: egui::Pos2) {
/// Choose `tool` from the toolbar. Dev Mode only inspects: a tool that edits leaves it for the
/// design.
fn choose(app: &mut FigApp, tool: ToolId) {
if app.ui.right_tab == crate::RightTab::Inspect && !matches!(tool, ToolId::Move | ToolId::Hand | ToolId::Comment) {
pub(crate) fn choose(app: &mut FigApp, tool: ToolId) {
if app.ui.right_tab == crate::RightTab::Inspect && !tool.works_in_dev_mode() {
app.ui.right_tab = crate::RightTab::Design;
}
app.run("tool.set", json!({"tool": tool.id()}));
+3 -2
View File
@@ -1,6 +1,6 @@
# Dev Mode parity
> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-07 · **Change:** patch (the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; class names transliterate non-ASCII layer names (#1235); measurements kept on the canvas; a read-only layers panel in Dev Mode; earlier: import lines in generated layer trees; compare with any saved version; Dev Mode behaviour suite: an inspect-only canvas, Changed in the ready list, statuses only on frames and sections; plugin panels from the Inspect tab) · **Target:** Figma Design Dev Mode (desktop app 126.10.7)
> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-09 · **Change:** patch (the Annotation tool (Shift+T, `tool.annotation {id?}`): with a layer selected (or an `id`) it asks the UI for that layer's note at once, and in the tool a press on a layer selects it and asks for its note, a press on empty canvas does nothing; the Inspect tab then opens (never toggles away) with the caret in that layer's new-note field, and the engine never writes the note itself (#1840); the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; class names transliterate non-ASCII layer names (#1235); measurements kept on the canvas; a read-only layers panel in Dev Mode; earlier: import lines in generated layer trees; compare with any saved version; Dev Mode behaviour suite: an inspect-only canvas, Changed in the ready list, statuses only on frames and sections; plugin panels from the Inspect tab) · **Target:** Figma Design Dev Mode (desktop app 126.10.7)
**Breadth ~98%, ready ~78% (estimated).** The inspect surface is broad, components connect
to the code components of a repository (with their imports, also inside generated layer trees),
@@ -15,7 +15,7 @@ repository, third-party integrations. Remaining: 1–2 h.
| Properties with their styles and variables; redlines on hover | done | positions from the frame around the layer (groups aren't frames), rotation, radius (CSS corner order), opacity, blend; colours in hex, RGB, CSS, HSL or HSB (`inspect.properties {colorFormat}`, the Inspect tab's Color format) |
| Code: CSS, iOS (SwiftUI), Android (Compose), Flutter | done | plus HTML, React, Vue and Leptos (ours; Leptos: `#[component]` functions with `#[prop]` defaults, variant enums and `view!` markup; Flutter is ours too: a `StatelessWidget` for a component, a widget tree for a layer); components take properties as parameters, instances are calls; CSS in px or rem (`inspect.code {unit, rootFontSize}`), with rotation, blend modes, gradient directions and kinds (linear, radial, conic), text alignment, case and decoration; class names from layer names transliterate non-ASCII scripts into readable ASCII (로그인 화면 → `rogeuin-hwamyeon`, кнопка → `knopka`, über → `uber`; symbols-only names take the node's kind, `.text`), and the 40-character cut lands on a word boundary (#1235) |
| Assets list with export | done | layers with export settings, icons (small, vector shapes only: SVG) and images (PNG); the icon rule is ours |
| Annotations: pinned properties, categories, coloured callouts, filter | done | |
| Annotations: pinned properties, categories, coloured callouts, filter | done | the Annotation tool (Shift+T, `tool.annotation`) picks a layer by a click or from the selection and opens its note field in the Inspect tab. Figma's placement, cursor and whether the tool stays selected are unmeasured (Developer Mode is paywalled in the web app); staying selected until V or Escape, like the Comment tool, is inferred, and there is no toolbar button or icon yet |
| Ready for dev list, statuses, "Changed" after edits | done | the list filters Ready for dev, Changed, Completed or any, and badges changed ones (`inspect.readyForDev {status: changed}`, `changed` per item); only sections and frames at the top of a page or section take a status (others are refused) |
| Focus view (one frame, previous / next) | done | |
| Compare changes (before/after side by side or overlaid, property diffs) | done | against the snapshot taken when a frame was first changed after it was marked ready, or any saved version (`dev.compare {version}`; the view's Compare with menu); a frame that isn't ready for dev compares with versions |
@@ -29,6 +29,7 @@ repository, third-party integrations. Remaining: 1–2 h.
| Date | Change | Summary |
|---|---|---|
| 2026-11-09 | patch | The Annotation tool (Shift+T, `tool.annotation {id?}`): selects the layer pressed on (or the selection, or `id`) and asks the UI for its note, which the Inspect tab takes in its new-note field; the engine writes nothing itself, and Developer Mode lets the tool through its gates (#1840). Figma's placement, cursor and whether the tool stays selected are unmeasured (Developer Mode is paywalled in the web app); staying selected until V or Escape, like the Comment tool, is inferred, and there is no toolbar button or icon yet |
| 2026-10-30 | minor | Gap 16: `figcraft-cli connect publish <file.figcraft> [--mappings figcraft.connect.json] [--dry-run]` publishes a code repository's mappings to a design file (as the incumbent's Code Connect CLI publishes a repository's mappings): it links each entry's component or set by name, warns about and skips links that don't fit, saves the file in place through the engine's save (or not, with `--dry-run`) and fails when nothing links. Dev Mode breadth (~98%) and ready (~78%) unchanged at this rounding; hours unchanged |
| 2026-10-26 | minor | Class names from layer names transliterate non-ASCII scripts (#1235): `class_name` runs names through `deunicode` (new dependency: pure Rust tables, zero deps, BSD-3-Clause), so Korean, Cyrillic, Latin-diacritic and CJK names become readable ASCII classes in HTML/CSS/React/Leptos output, component roots and `data-*` variant attributes (`rogeuin-hwamyeon`, `knopka`, `uber`, `an-niu`; before, every one of them came out `layer-`); symbols-only names take the node's kind (`.text`, `.frame`) instead of `layer-`, and the 40-character cut lands on a word boundary. ASCII-only names are unchanged. `html_codegen_tests` updated (its diacritics expectation improves from `layer-1-n-code-name` to `layer-1-unicode-name`) and extended. Percentages and hours unchanged |
| 2026-10-24 | minor | Dev Mode refuses design edits from files dropped on the canvas (a dropped document still opens as a file of its own, and the drop overlay shows the Dev Mode note for other files), from the Pages list's add, rename, reorder, duplicate and delete, and from the Assets panel's place, drag, Alt-drop swap, style, Hide when publishing, Update, and adding, removing and swapping libraries. Percentages and hours unchanged |
+6 -4
View File
File diff suppressed because one or more lines are too long