isokit: project layer, Studio GUI, MCP server, viewer, CLI, demo project and docs

This commit is contained in:
grabowski committed 2026-10-22 15:29:07 +07:00
1 parent 95c80ec6b1
commit 564aeb75f6
47 files changed
+5978 -366

No files matched your search

+15 -4
View File
@@ -43,7 +43,9 @@ fn upsert(list: &mut Vec<(String, String)>, k: &str, v: String) {
fn strings(t: Option<&toml::Value>, what: &str) -> Result<Vec<(String, String)>, String> {
let Some(v) = t else { return Ok(vec![]) };
let tab = v.as_table().ok_or_else(|| format!("[{what}] must be a table"))?;
let tab = v
.as_table()
.ok_or_else(|| format!("[{what}] must be a table"))?;
tab.iter()
.map(|(k, v)| match v {
toml::Value::String(s) => Ok((k.clone(), s.clone())),
@@ -58,7 +60,8 @@ impl Theme {
/// The built-in default theme.
pub fn default_theme() -> Self {
let mut t = Theme::default();
t.merge_str(DEFAULT, "default").expect("built-in theme parses");
t.merge_str(DEFAULT, "default")
.expect("built-in theme parses");
t
}
@@ -79,7 +82,11 @@ impl Theme {
for (k, v) in strings(tab.get("rules"), "rules").map_err(err)? {
upsert(&mut self.rules, &k, v);
}
if let Some(css) = tab.get("extra").and_then(|e| e.get("css")).and_then(|c| c.as_str()) {
if let Some(css) = tab
.get("extra")
.and_then(|e| e.get("css"))
.and_then(|c| c.as_str())
{
self.extra.push_str(css);
self.extra.push('\n');
}
@@ -118,7 +125,11 @@ impl Theme {
match light {
None => {
block(&mut o, scope, &self.dark);
block(&mut o, &format!("html[data-theme=light] {scope}"), &self.light);
block(
&mut o,
&format!("html[data-theme=light] {scope}"),
&self.light,
);
}
Some(false) => block(&mut o, scope, &self.dark),
Some(true) => {