M6: Uno vectors as Path and docs for the layer code card

Vectors, booleans and shapes are a Microsoft.UI.Xaml.Shapes.Path with path
data from the node's outline (F1 non-zero, F0 even-odd, at most 5,000
elements), one solid fill and one solid stroke; stroke inside or outside is a
note. Gradients, several paints, effects and over-cap outlines fall back to a
PNG Image. Docs: parity, MCP, gaps, ROADMAP.
This commit is contained in:
Andrej Skvorc committed 2026-11-16 13:10:26 +01:00
1 parent 7429df2c13
commit fe7b9d0495
6 files changed
+229 -33

No files matched your search

+1
View File
@@ -365,6 +365,7 @@ Ranked; detail and milestones in [`docs/roadmap.md`](docs/roadmap.md).
| Date | Change | Summary |
|---|---|---|
| 2026-11-14 | minor | M6: Uno C# Markup code, auto layout and vectors (ours): a frame with horizontal or vertical auto layout is a Toolkit `AutoLayout` that takes the box itself (`Background`, `BorderBrush`, `BorderThickness`, `CornerRadius`) with `Orientation`, `Spacing`, `Padding` (less the stroke weight unless strokes are included; where that goes negative the border sits behind the layout in a `Grid`), `PrimaryAxisAlignment`, `CounterAxisAlignment` and `Justify`; children are sized per axis (fixed writes the length, hug none, fill stretches with the attached `AutoLayout` call, min and max lengths on the child), text hugs, fills or is fixed, a child that ignores the layout is independent at its offset (a hugging parent with one is written at its size), and `reverse_z` paints with descending `Canvas.ZIndex`; grid mode is a `Grid` with `ColumnDefinitions` / `RowDefinitions` (pixels, `Auto`, whole-number stars), `ColumnSpacing` / `RowSpacing`, children in the cell the layout crate gives them (`.Grid(row:, column:, rowSpan:, columnSpan:)`) aligned in it; wrap is one line with a note; frames without auto layout keep the `Canvas` with one warning per view that counts them; an explicit line height moves the text down by the half-leading of the face FigCraft draws with (a top padding with a negative bottom margin in a panel, the offset in a `Canvas`; the number depends on the fonts installed where `inspect.code` runs; a line height below the font's natural height is a note); vectors, booleans and shapes are a `Microsoft.UI.Xaml.Shapes.Path` with path data (`F1` non-zero, `F0` even-odd; at most 5,000 elements), one solid fill and one solid stroke, falling back to a PNG `Image` for gradients, several paints, effects and over the cap; containers are locals and children go in with `Children.Add(x)` / `Child = x`, since fluent `.Children(…)` doubles the load time with every level of nesting. Numbers unchanged (the incumbent has no such target). |
| 2026-11-10 | minor | M6: Uno Platform C# Markup code (ours; the incumbent generates CSS, iOS and Android only): `inspect.code {language: uno}` (aliases `csharp-markup`, `cs-markup`) writes a `UserControl` class whose content is a fluent C# Markup tree for a layer: a frame, group or rectangle is a `Border` (fill as `Color.FromArgb`, border brush and thickness, per-side thickness, per-corner radius, opacity, rotation) holding a `Canvas` with the children at their offsets (a stroke and children put the border behind the canvas in a `Grid`, so the stroke does not push the children in), an ellipse is an `Ellipse`, text is a `TextBlock` (family, size, weight, italic, colour, line height, character spacing, alignment, wrapping, trimming and max lines from the auto resize mode, decoration, case applied when the code runs, mixed styles as `Run`s) and vectors and other shapes are an `Image` on an SVG asset (`ms-appx:///Assets/<name>.svg`, a lowercase ASCII name unique in the snippet) with a comment to export it; image fills are an `ImageBrush` on a PNG asset. Fixed sizes everywhere; auto layout, variables, components and the project export are later steps. Shadows, blurs, blend modes, gradients beyond the first stop, masks and corner smoothing stay as `// not mapped: …` comments in the chain. Not offered for code connect or component code yet. Headline numbers unchanged. |
| 2026-11-10 | minor | M4, #2222: a boolean group takes a corner radius that rounds every sharp corner of its result. Numbers unchanged |
| 2026-11-10 | minor | M12, #2226 (step 1 of 4): mind maps in the document and engine. `board.mindMap` places a first node with three children on curved branches and `board.mindMapAdd` adds a child or a sibling; the normalize pass lays a touched map out again from its first node (88 between columns, 48 between siblings, stacks centred on their parents). No toolbar entry yet; numbers unchanged. |
+1 -1
View File
@@ -39,7 +39,7 @@ pub(crate) use html::{Markup, Names, class_name};
pub(crate) use swift::swift;
pub(crate) use uno::uno;
#[cfg(test)]
pub(crate) use uno::{asset_name, cs_ident, cs_literal, cs_unique};
pub(crate) use uno::{asset_name, cs_ident, cs_literal, cs_unique, path_data};
pub fn specs() -> Vec<CommandSpec> {
vec![spec!(
+69 -3
View File
@@ -682,19 +682,56 @@ impl Gen<'_> {
e
}
/// A vector, shape or other layer without a counterpart: the image the app is to hold.
/// A vector, shape or other layer without a counterpart: a `Path` with the outline as path
/// data, which takes the theme's colours; or, when the layer is more than one plain fill and
/// one plain stroke, the image the app is to hold.
fn asset(&mut self, n: &Node, at: Place) -> Element {
if let Some(e) = self.path(n, at) {
return e;
}
let name = asset_name(&n.name, n.kind.label(), &mut self.assets);
let mut e = Element::new("new Image()");
e.lead.push(format!("// {} \"{}\": export it as an SVG to Assets/{name}.svg", n.kind.label(), comment_name(&n.name)));
e.lead.push(format!("// {} \"{}\": export it as a PNG to Assets/{name}.png", n.kind.label(), comment_name(&n.name)));
place(&mut e, n, at);
e.call(format!(".Source(\"{ASSETS}/{name}.svg\")"));
e.call(format!(".Source(\"{ASSETS}/{name}.png\")"));
size(&mut e, n, at);
e.call(".Stretch(Stretch.Uniform)");
common(&mut e, n);
e
}
/// The layer's outline as a `Microsoft.UI.Xaml.Shapes.Path` (written in full: the implicit
/// usings bring in `System.IO`, whose `Path` clashes), with at most one solid fill and one solid
/// stroke. `None` when the layer needs the image: a gradient, image or pattern paint, several
/// fills or strokes, effects, no outline, or an outline past [`MAX_PATH_ELEMENTS`].
fn path(&mut self, n: &Node, at: Place) -> Option<Element> {
let fills: Vec<_> = n.fills.iter().filter(|p| p.visible).collect();
let strokes: Vec<_> = n.strokes.iter().filter(|p| p.visible).collect();
let plain = |ps: &[&figcraft_color::Paint]| ps.iter().all(|p| matches!(p.kind, PaintKind::Solid { .. }));
if fills.len() > 1 || strokes.len() > 1 || !plain(&fills) || !plain(&strokes) || n.effects.iter().any(|f| f.visible) {
return None;
}
let (outline, rule) = figcraft_render::node_outline(self.ctx.doc, n)?;
let data = path_data(&outline, rule)?;
let mut e = Element::new("new Microsoft.UI.Xaml.Shapes.Path()");
place(&mut e, n, at);
e.call(format!(".Data({})", cs_literal(&data)));
if let Some(c) = first_fill(n) {
e.call(format!(".Fill({})", cs_color(c)));
}
if let Some(c) = stroke_color(n) {
e.call(format!(".Stroke({})", cs_color(c)));
e.call(format!(".StrokeThickness({})", num(n.stroke.weight)));
if n.stroke.align != StrokeAlign::Center {
// A `Path` stroke is centred on the outline.
e.note("stroke inside or outside (drawn centred)");
}
}
size(&mut e, n, at);
common(&mut e, n);
Some(e)
}
/// Text: a `TextBlock`, in a `Grid` of the box's height when it is aligned to the middle or
/// bottom of a fixed box. An explicit line height puts half the leading above the first line in
/// FigCraft and all of it below in Uno, so the text is moved down by the half-leading.
@@ -988,6 +1025,35 @@ fn leading_calls(e: &mut Element, leading: Leading, flow: bool) {
}
}
/// Most elements (moves, lines, curves, closes) of an outline written as path data.
const MAX_PATH_ELEMENTS: usize = 5_000;
/// An outline as the path mini-language of `Path.Data`: a fill rule (`F1` non-zero, `F0` even-odd)
/// then `M x y`, `L x y`, `Q cx cy x y`, `C c1x c1y c2x c2y x y` and `Z`, numbers through [`num`].
/// `None` for an empty outline, one with a coordinate that is not finite, or one past
/// [`MAX_PATH_ELEMENTS`].
pub(crate) fn path_data(path: &figcraft_geom::BezPath, rule: figcraft_render::FillRule) -> Option<String> {
use figcraft_geom::kurbo::PathEl;
let els = path.elements();
if els.is_empty() || els.len() > MAX_PATH_ELEMENTS {
return None;
}
let pt = |p: figcraft_geom::Point| (p.x.is_finite() && p.y.is_finite()).then(|| format!("{} {}", num(p.x), num(p.y)));
let mut out = String::from(if rule == figcraft_render::FillRule::EvenOdd { "F0" } else { "F1" });
for el in els {
let part = match *el {
PathEl::MoveTo(p) => format!("M {}", pt(p)?),
PathEl::LineTo(p) => format!("L {}", pt(p)?),
PathEl::QuadTo(c, p) => format!("Q {} {}", pt(c)?, pt(p)?),
PathEl::CurveTo(c1, c2, p) => format!("C {} {} {}", pt(c1)?, pt(c2)?, pt(p)?),
PathEl::ClosePath => "Z".to_string(),
};
out.push(' ');
out.push_str(&part);
}
Some(out)
}
/// The calls an `AutoLayout` takes for its orientation, gap, padding (`pad` is top, right,
/// bottom, left as written) and alignment.
fn layout_calls(e: &mut Element, l: &AutoLayout, pad: [f64; 4]) {
+126 -15
View File
@@ -252,21 +252,6 @@ fn mixed_styles_become_runs() {
assert!(!code.contains(".Text(\"Plain bold end\")"), "{code}");
}
#[test]
fn vectors_are_svg_assets_with_unique_lowercase_names() {
let mut s = Session::new();
let f = frame(&mut s, "Icons", 200.0, 100.0);
for x in [0, 50, 100] {
ex(&mut s, "node.create", json!({"type": "star", "parent": f, "name": "Star Icon", "x": x, "y": 0, "width": 40, "height": 40}));
}
let code = uno(&mut s, f);
for n in ["star_icon", "star_icon_2", "star_icon_3"] {
assert!(code.contains(&format!(".Source(\"ms-appx:///Assets/{n}.svg\")")), "{n} in {code}");
assert!(code.contains(&format!("// Star \"Star Icon\": export it as an SVG to Assets/{n}.svg")), "{code}");
}
assert!(code.contains(".Stretch(Stretch.Uniform)"), "{code}");
}
#[test]
fn an_image_fill_is_an_image_brush_on_a_png_asset() {
use base64::Engine as _;
@@ -870,3 +855,129 @@ fn a_font_that_is_not_installed_gets_no_shift_and_a_note() {
assert!(c.iter().any(|l| l.starts_with("// not mapped: line height shift")), "{c:?}");
assert!(!c.iter().any(|l| l.starts_with(".Padding(") || l.starts_with(".Margin(")), "{c:?}");
}
#[test]
fn path_data_writes_moves_lines_curves_and_closes_with_the_fill_rule() {
use crate::codegen::path_data;
use figcraft_geom::BezPath;
use figcraft_render::FillRule;
let mut p = BezPath::new();
p.move_to((0.0, 0.0));
p.line_to((24.0, 0.0));
p.quad_to((30.5, 6.25), (24.0, 12.0));
p.curve_to((20.0, 20.0), (4.0, 20.125), (0.0, 12.0));
p.close_path();
assert_eq!(path_data(&p, FillRule::Winding).as_deref(), Some("F1 M 0 0 L 24 0 Q 30.5 6.25 24 12 C 20 20 4 20.13 0 12 Z"));
assert!(path_data(&p, FillRule::EvenOdd).is_some_and(|d| d.starts_with("F0 M 0 0")));
// An open path has no Z; a second subpath starts with its own M.
let mut open = BezPath::new();
open.move_to((1.0, 2.0));
open.line_to((3.0, 4.0));
open.move_to((5.0, 6.0));
open.line_to((7.0, 8.0));
assert_eq!(path_data(&open, FillRule::Winding).as_deref(), Some("F1 M 1 2 L 3 4 M 5 6 L 7 8"));
}
#[test]
fn path_data_refuses_empty_non_finite_and_huge_outlines() {
use crate::codegen::path_data;
use figcraft_geom::BezPath;
use figcraft_render::FillRule;
assert!(path_data(&BezPath::new(), FillRule::Winding).is_none());
let mut bad = BezPath::new();
bad.move_to((0.0, 0.0));
bad.line_to((f64::NAN, 1.0));
assert!(path_data(&bad, FillRule::Winding).is_none());
let mut inf = BezPath::new();
inf.move_to((0.0, f64::INFINITY));
assert!(path_data(&inf, FillRule::Winding).is_none());
let mut huge = BezPath::new();
huge.move_to((0.0, 0.0));
for i in 0..5_000 {
huge.line_to((f64::from(i), 1.0));
}
assert!(path_data(&huge, FillRule::Winding).is_none(), "5,001 elements are past the cap");
let mut ok = BezPath::new();
ok.move_to((0.0, 0.0));
for i in 0..4_999 {
ok.line_to((f64::from(i), 1.0));
}
assert!(path_data(&ok, FillRule::Winding).is_some());
}
#[test]
fn a_star_is_a_path_with_its_fill_and_size_and_no_asset() {
let mut s = Session::new();
let f = frame(&mut s, "Icons", 100.0, 100.0);
let star =
idv(&ex(&mut s, "node.create", json!({"type": "star", "parent": f, "name": "Star Icon", "x": 10, "y": 20, "width": 40, "height": 40})));
set(&mut s, star, json!({"fill": "#141414"}));
let code = uno(&mut s, f);
let c = chain(&code, "starIcon");
assert_eq!(c.first().map(String::as_str), Some(".Canvas(left: 10, top: 20)"), "{code}");
let data = c.iter().find(|l| l.starts_with(".Data(\"F1 M ")).cloned().unwrap_or_default();
assert!(data.ends_with(" Z\")") && data.contains(" L "), "{c:?}");
assert!(c.contains(&".Fill(Color.FromArgb(0xFF, 0x14, 0x14, 0x14))".to_string()), "{c:?}");
assert!(c.contains(&".Width(40)".to_string()) && c.contains(&".Height(40)".to_string()), "{c:?}");
assert!(code.contains("var starIcon = new Microsoft.UI.Xaml.Shapes.Path()"), "{code}");
assert!(!code.contains("Assets/") && !code.contains(".svg") && !code.contains("new Image()"), "{code}");
}
#[test]
fn a_boolean_result_and_an_even_odd_outline_are_paths_too() {
let mut s = Session::new();
let f = frame(&mut s, "Shapes", 200.0, 100.0);
let a = idv(&ex(&mut s, "shape.rectangle", json!({"x": 0, "y": 0, "width": 40, "height": 40, "parent": f, "props": {"name": "A"}})));
let b = idv(&ex(&mut s, "shape.rectangle", json!({"x": 20, "y": 20, "width": 40, "height": 40, "parent": f, "props": {"name": "B"}})));
let u = idv(&ex(&mut s, "bool.union", json!({"ids": [a, b]})));
set(&mut s, u, json!({"name": "Union", "fill": "#00FF00"}));
let code = uno(&mut s, f);
let c = chain(&code, "union");
assert!(c.iter().any(|l| l.starts_with(".Data(\"F") && l.contains(" M ")), "{code}");
// A boolean's result is even-odd; a star is non-zero.
assert!(c.iter().any(|l| l.starts_with(".Data(\"F0 ")), "{c:?}");
assert!(!code.contains("export it as"), "{code}");
}
#[test]
fn a_stroked_vector_has_a_centred_stroke_and_a_note_for_inside_or_outside() {
let mut s = Session::new();
let f = frame(&mut s, "Strokes", 100.0, 100.0);
let v = idv(&ex(&mut s, "node.create", json!({"type": "star", "parent": f, "name": "Line Star", "x": 0, "y": 0, "width": 30, "height": 30})));
set(&mut s, v, json!({"fill": "#FF0000", "stroke": "#0000FF", "strokeWeight": 2, "strokeAlign": "center"}));
let c = chain(&uno(&mut s, f), "lineStar");
assert!(c.contains(&".Stroke(Color.FromArgb(0xFF, 0x00, 0x00, 0xFF))".to_string()) && c.contains(&".StrokeThickness(2)".to_string()), "{c:?}");
assert!(!c.iter().any(|l| l.starts_with("//")), "{c:?}");
set(&mut s, v, json!({"strokeAlign": "inside"}));
let c = chain(&uno(&mut s, f), "lineStar");
assert!(c.contains(&"// not mapped: stroke inside or outside (drawn centred)".to_string()), "{c:?}");
}
#[test]
fn vectors_that_a_path_cannot_draw_are_png_assets_with_unique_lowercase_names() {
let mut s = Session::new();
let f = frame(&mut s, "Icons", 300.0, 100.0);
let gradient = json!({"type": "gradient", "kind": "linear",
"stops": [{"position": 0, "color": {"r": 1, "g": 0, "b": 0, "a": 1}}, {"position": 1, "color": {"r": 0, "g": 0, "b": 1, "a": 1}}],
"from": [0, 0.5], "to": [1, 0.5]});
let mut ids = Vec::new();
for x in [0, 50, 100, 150] {
ids.push(idv(&ex(
&mut s,
"node.create",
json!({"type": "star", "parent": f, "name": "Star Icon", "x": x, "y": 0, "width": 40, "height": 40}),
)));
}
set(&mut s, ids[0], json!({"fills": [gradient]}));
set(&mut s, ids[1], json!({"fills": ["#FF0000", "#00FF00"]}));
set(&mut s, ids[2], json!({"effects": [{"type": "dropShadow", "color": "#00000040", "offset": [0, 4], "radius": 8}]}));
let code = uno(&mut s, f);
for n in ["star_icon", "star_icon_2", "star_icon_3"] {
assert!(code.contains(&format!(".Source(\"ms-appx:///Assets/{n}.png\")")), "{n} in {code}");
assert!(code.contains(&format!("// Star \"Star Icon\": export it as a PNG to Assets/{n}.png")), "{code}");
}
assert!(code.contains(".Stretch(Stretch.Uniform)"), "{code}");
// The fourth is plain: a path, and it takes no asset name.
assert_eq!(code.matches("new Microsoft.UI.Xaml.Shapes.Path()").count(), 1, "{code}");
assert!(!code.contains("star_icon_4") && !code.contains(".svg"), "{code}");
}
+5 -3
View File
@@ -477,9 +477,11 @@ No alpha blockers: the alpha gate in [`roadmap.md`](roadmap.md#alpha-gate) passe
- **Landed (2026-10-24):** files dropped on the canvas, the Pages list and the Assets panel no
longer edit the design in Dev Mode (a dropped document still opens as a file of its own, and
the Pages list only opens pages).
- **Landed (2026-11-10):** Uno Platform C# Markup for layers: `inspect.code {language: uno}` writes frames, groups, rectangles,
ellipses, text (also mixed styles) and image or vector assets as a fluent C# tree (a `Border` with a `Canvas` for the children at their
offsets, `TextBlock`, `Ellipse`, `Image`), fixed sizes. Still to do: auto layout (`AutoLayout` panels), variables as theme resources,
- **Landed (2026-11-14):** Uno Platform C# Markup for layers: `inspect.code {language: uno}` writes frames with horizontal, vertical or
grid auto layout (`AutoLayout`, `Grid`; sizing per axis, absolute children, first-on-top order), frames without auto layout
(`Border` with a `Canvas`, one warning per view), groups, rectangles, ellipses, text (also mixed styles, with the half-leading of
explicit line heights), vectors and booleans as `Path` data, and PNG assets for what a path cannot draw. Children are added with
`Children.Add` / `Child =`. Still to do: wrapping layouts (`FlexPanel`, needs Uno Toolkit 10), variables as theme resources,
components, variants and code connect for Uno, a folder export that writes the asset files.
- **Landed (2026-10-30):** `figcraft-cli connect publish <file.figcraft> [--mappings
figcraft.connect.json] [--dry-run]` publishes a code repository's mappings to a design file, so
+27 -11
View File
@@ -1765,17 +1765,33 @@ permissions: without it nothing is downloaded); `plugin.directory.publish {path
{id?, language?}` returns the parts: `{component, name, set, properties: [{name, param, type,
default, value? (instances)}], definition, usage? (instances)}`.
- **Uno C# Markup:** `inspect.code {id, language: uno}` (aliases `csharp-markup`, `cs-markup`) writes the layer and its subtree as a
`UserControl` class (file-scoped `namespace MyApp;`, the class named after the layer plus `View`, internal) whose `this.Content(…)` is a
Uno C# Markup (`Uno.Extensions.Markup`) expression: a frame, group or rectangle is a `Border` with `Background`, `BorderBrush`,
`BorderThickness` (a `Thickness` for per-side strokes), `CornerRadius` (per corner when they differ), `Opacity` and a
`RenderTransform` for rotation, holding a `Canvas` whose children carry `.Canvas(left:, top:)`; with a stroke and children it is a
`Grid` with the border behind the canvas. Text is a `TextBlock` (`FontFamily`, `FontSize`, `FontWeight`, `FontStyle`, `Foreground`,
`LineHeight`, `CharacterSpacing` in thousandths of an em, `TextAlignment`, `TextWrapping`, `TextTrimming`, `MaxLines`,
`TextDecorations`; case is applied at run time; style runs are `Inlines` of `Run`s). Vectors and other shapes are an `Image` on
`ms-appx:///Assets/<name>.svg`, image fills an `ImageBrush` on `<name>.png` (names lowercase ASCII, unique in the snippet; the files
are not written). Everything has a fixed size. Shadows, blurs, blend modes, masks, gradients beyond the first stop, pattern fills,
stroke alignment other than inside, corner smoothing and arcs are `// not mapped: …` comments. Components and instances are written
as the frames they are; `inspect.componentCode` and code connect do not take `uno` yet.
`UserControl` class (file-scoped `namespace MyApp;`, the class named after the layer plus `View`, internal) whose constructor builds the
tree with Uno C# Markup (`Uno.Extensions.Markup`) and ends with `Content = root;`. Each element is a local with fluent property setters;
its children are added with `parent.Children.Add(child)` or `parent.Child = child`, never the fluent `.Children(…)` / `.Child(…)`,
whose load time doubles with every level of nesting. A frame with horizontal or vertical auto layout is a Toolkit `AutoLayout` that takes
the box itself (`Background`, `BorderBrush`, `BorderThickness`, `CornerRadius`, `Opacity`) with `Orientation`, `Spacing`, `Padding` (less
the stroke weight unless the layout includes strokes; where a side would go negative the border sits behind the layout in a `Grid`),
`PrimaryAxisAlignment`, `CounterAxisAlignment` and `Justify`; space around and evenly are written as space between, baseline alignment
and a wrapping layout are `// not mapped: …` notes (a wrapping layout is one line). Children are sized per axis: fixed writes `Width` /
`Height`, hug writes none, fill stretches with `.AutoLayout(primaryAlignment:, counterAlignment:)`, `MinWidth` / `MaxWidth` / `MinHeight`
/ `MaxHeight` go on the child; a child that ignores the layout is `.AutoLayout(isIndependentLayout: true)` at its offset as a `Margin`
(a hugging parent with one is written at its current size), and "first on top" is a descending `.Canvas(zIndex: n)`. A grid is a `Grid`
with `ColumnDefinitions` / `RowDefinitions` (pixels, `Auto`, whole-number stars: fractional shares are scaled up to a factor of 100 or
rounded with a note; at most 64 tracks per axis), `ColumnSpacing` (the layout's gap) and `RowSpacing` (its cross gap), and each child in
its cell with `.Grid(row:, column:, rowSpan:, columnSpan:)` and its alignment in the cell. A frame without auto layout, a group or a
rectangle is a `Border` holding a `Canvas` whose children carry `.Canvas(left:, top:)`, with a stroke and children a `Grid` with the
border behind; one `// warning:` comment above the root counts such frames. Text is a `TextBlock` (`FontFamily`, `FontSize`,
`FontWeight`, `FontStyle`, `Foreground`, `LineHeight`, `CharacterSpacing` in thousandths of an em, `TextAlignment`, `TextWrapping`,
`TextTrimming`, `MaxLines`, `TextDecorations`; case is applied at run time; style runs are `Inlines` of `Run`s); an explicit line height
moves it down by the half-leading `(L - (ascent + descent) / upem * size) / 2` of the face FigCraft draws with (a top padding and a
negative bottom margin in a panel, the offset in a `Canvas`), so the code depends on the fonts installed where `inspect.code` runs;
with the family missing, or a line height below the font's natural height, it is a note. Vectors, booleans and shapes are a
`Microsoft.UI.Xaml.Shapes.Path` with `Data("F1 M …")` (`F1` non-zero, `F0` even-odd; at most 5,000 elements), one solid `Fill` and one
solid `Stroke`; gradients, several fills or strokes, effects and bigger outlines are an `Image` on `ms-appx:///Assets/<name>.png` with a
comment to export it. Image fills are an `ImageBrush` on `<name>.png` (names lowercase ASCII, unique in the snippet; the files are not
written). Shadows, blurs, blend modes, masks, gradients beyond the first stop, pattern fills, stroke alignment other than inside,
corner smoothing and arcs are `// not mapped: …` comments. Components and instances are written as the frames they are;
`inspect.componentCode` and code connect do not take `uno` yet.
- **Code connect:** link a component (a variant links its set) to the code component it is built
as, per language (`react`, `leptos`, `vue`, `swiftui`, `compose`, `arkui`, `flutter`): `codeConnect.set {id?, language?, importPath?,
name?, template?}` (undoable; fields left out keep their value; the defaults are the generated