refactor(engine): simplify asset and code generation helpers

This commit is contained in:
Dylan M. Taylor
2026-10-28 16:00:36 +00:00
parent 5e16683963
commit d87f9effe1
36 changed files with 1062 additions and 849 deletions
+4 -1
View File
@@ -11,7 +11,10 @@
use std::collections::BTreeMap;
use figcraft_color::{Color, Paint};
use figcraft_doc::*;
use figcraft_doc::{
AutoLayout, Collection, CollectionId, CrossAlign, DocError, DocResult, Document, LayoutMode, Mode, ModeId, Node, NodeId, NodeKind, PropDef,
Sizing, Style, StyleKind, TextAutoResize, TextData, TextStyle, Variable, VariableType, VariableValue,
};
use serde_json::Value;
use crate::components::{create_instance, sync_instance};
@@ -6,7 +6,7 @@ use figcraft_doc::NodeId;
use serde_json::{Value, json};
use super::glyphs::{self, Glyph};
use super::kit::*;
use super::kit::{ACCENT, BORDER, BOTTOM_EDGE, CARD, H, ICON, INK, Kit, MUTED, ON_BRAND, PAGE, PRIMARY, RIGHT_EDGE, SOFT, V, merged};
use crate::Result;
const NAV: [(&str, Glyph); 6] = [
@@ -6,7 +6,7 @@
use figcraft_doc::NodeId;
use serde_json::{Value, json};
use super::kit::*;
use super::kit::{H, Kit, TYPE, V, merged};
use crate::Result;
const THEME: &str = "Theme";
@@ -6,7 +6,7 @@ use figcraft_doc::NodeId;
use serde_json::json;
use super::glyphs;
use super::kit::*;
use super::kit::{BORDER, CARD, H, ICON, INK, Kit, MUTED, PAGE, V, merged};
use crate::Result;
const STROKE: &str = "Icon/Stroke";
@@ -6,7 +6,7 @@ use figcraft_doc::NodeId;
use serde_json::{Value, json};
use super::glyphs::{self, Glyph};
use super::kit::*;
use super::kit::{BORDER, BOTTOM_EDGE, CARD, H, ICON, INK, Kit, MUTED, ON_BRAND, PAGE, PRIMARY, SOFT, SUNKEN, TOP_EDGE, V, merged, shadow};
use crate::Result;
/// The widest the content gets.
@@ -6,7 +6,7 @@ use figcraft_doc::NodeId;
use serde_json::json;
use super::glyphs::{self, Glyph};
use super::kit::*;
use super::kit::{BORDER, CARD, H, ICON, INK, Kit, MUTED, ON_BRAND, PAGE, PRIMARY, SUNKEN, TOP_EDGE, V, shadow};
use crate::Result;
const W: f64 = 390.0;
@@ -6,7 +6,7 @@ use figcraft_doc::NodeId;
use serde_json::{Value, json};
use super::glyphs;
use super::kit::*;
use super::kit::{ACCENT, BORDER, BOTTOM_EDGE, CARD, DEEP, H, INK, Kit, MUTED, ON_BRAND, PAGE, PRIMARY, TOP_EDGE, V, merged};
use crate::Result;
const W: f64 = 1920.0;
@@ -6,7 +6,7 @@ use figcraft_doc::NodeId;
use serde_json::json;
use super::glyphs;
use super::kit::*;
use super::kit::{ACCENT, DEEP, H, INK, Kit, ON_BRAND, V};
use crate::Result;
/// (name, width, height, x, y) on the canvas.
@@ -6,7 +6,7 @@ use figcraft_doc::NodeId;
use serde_json::{Value, json};
use super::glyphs;
use super::kit::*;
use super::kit::{BOTTOM_EDGE, H, Kit, TOP_EDGE, TYPE, V, merged};
use crate::Result;
const WIRE_INK: &str = "Wire/Ink";