The Background tab fills in — facets rendered to order, eight hues in a carousel

Claude-Session: https://claude.ai/code/session_01SR4XGjmBE16ZUYWpfFHXwY
This commit is contained in:
2026-08-07 16:08:29 -04:00
parent 56e37be158
commit fb96e30df0
19 changed files with 3031 additions and 38 deletions
+24 -1
View File
@@ -59,12 +59,35 @@ extension FrontmatterDocument {
}
return
}
setBackgroundSubkey(FrontmatterKeys.Background.color, to: value)
}
/// **Writes the `image` subkey** `setStyleValue`'s colour write, one subkey over
/// (03-board-ui.md § Styling Capabilities).
///
/// The doc comment above says "There is no image picker and none is planned"; that sentence held
/// until generated backgrounds (DESIGN/explorations/board-backgrounds.md), which do not make one
/// either. What the generator writes is a *file it just created in the board folder* and the name
/// it wrote it under the app is not browsing the user's pictures, it is naming its own output
/// so the hand-written path stays the escape hatch it always was, and this write preserves it the
/// same way the colour write preserves an image: by subkey.
///
/// Everything else is `setStyleValue`'s, deliberately shared rather than restated: the same
/// in-place merge, the same flow-mapping emission, the same removal-empties-the-key rule, and the
/// same replacement of a non-mapping shape the schema could never read.
public mutating func setBackgroundImage(_ value: String?) {
setBackgroundSubkey(FrontmatterKeys.Background.image, to: value)
}
/// The one merge both subkey writes go through see `setStyleValue` for every rule it applies.
private mutating func setBackgroundSubkey(_ subkey: String, to value: String?) {
let key = FrontmatterKeys.background
// Only a mapping has subkeys worth carrying; every other shape absent, the retired scalar,
// a sequence starts empty and is replaced outright by what the app writes.
var existing: [YAMLValue.Pair] = []
if case let .mapping(pairs)? = self.value(for: key) { existing = pairs }
let merged = Self.merged(existing, subkey: FrontmatterKeys.Background.color, value: value)
let merged = Self.merged(existing, subkey: subkey, value: value)
if merged.isEmpty {
remove(key)
} else {