feat(ui): pattern modes, bundles, and zone content kind
Add profile/preset/sequence JSON import and export; map preset mode to wire n6 with a mode dropdown for multi-mode patterns; zone edit shows presets or sequences only with content_kind on save; update catalogue and tests for merged pattern names. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -113,6 +113,21 @@ def resolve_preset_background_hex(preset_data, palette_colors=None):
|
||||
return _hex_from_background_raw(bg_raw)
|
||||
|
||||
|
||||
def wire_n6(preset_data, default=0):
|
||||
"""Resolve style mode for the wire (``n6``); preset may store ``mode`` or ``n6``."""
|
||||
if not isinstance(preset_data, dict):
|
||||
return default
|
||||
if preset_data.get("mode") is not None:
|
||||
try:
|
||||
return max(0, int(preset_data["mode"]))
|
||||
except (TypeError, ValueError):
|
||||
pass
|
||||
try:
|
||||
return max(0, int(preset_data.get("n6", default) or 0))
|
||||
except (TypeError, ValueError):
|
||||
return default
|
||||
|
||||
|
||||
def build_preset_dict(preset_data, palette_colors=None):
|
||||
"""
|
||||
Convert preset data to API-compliant format.
|
||||
@@ -188,7 +203,7 @@ def build_preset_dict(preset_data, palette_colors=None):
|
||||
"n3": preset_data.get("n3", 0),
|
||||
"n4": preset_data.get("n4", 0),
|
||||
"n5": preset_data.get("n5", 0),
|
||||
"n6": preset_data.get("n6", 0)
|
||||
"n6": wire_n6(preset_data),
|
||||
}
|
||||
|
||||
return preset
|
||||
|
||||
Reference in New Issue
Block a user