⚙️ JSONNET RUNE DIFFICULTY: Adept Structural

The Bridge of Jsonnet

Decoupling an abstraction from its implementation.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Bridge
ARCANUM SCHOOL: Transmutation // Astral Connection
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// JSONNET PATTERN //
local Theme = {
  color: "black",
  font: "arial"
};

local DarkTheme = Theme { color: "darkgrey" };
local LightTheme = Theme { color: "white" };

local UIElement(theme) = {
  theme: theme,
  render():: "Rendering element with color " + self.theme.color
};

{
  darkButton: UIElement(DarkTheme) + { type: "Button" },
  lightWindow: UIElement(LightTheme) + { type: "Window" }
}

The Bridge separates the UI structure from its styling theme, allowing both to evolve independently in the ether of configuration.

Runic Tags: #structural #bridge #jsonnet