Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
design_export.hpp
Go to the documentation of this file.
1#pragma once
2
6
7#include <pulp/view/theme.hpp>
8#include <string>
9#include <unordered_map>
10
11namespace pulp::view {
12
25public:
27 static std::string to_json(const Theme& theme);
28
37 static std::string to_css(const Theme& theme, const std::string& prefix = "pulp");
38
46 static std::string to_cpp_header(const Theme& theme, const std::string& namespace_name);
47
52 static std::string to_oklch_css(const Theme& theme, const std::string& prefix = "pulp");
53
62 static std::string to_wgsl_uniforms(const Theme& theme, const std::string& struct_name = "ThemeUniforms");
63};
64
65// ── DESIGN.md emitter ─────────────────────────────────────────────────────
66//
67// `export_designmd` is the shared write path for serializing a Theme back into
68// a DESIGN.md-shaped document:
69//
70// 1. `pulp import-design --from <source> --update-design-md` — merges
71// an external re-import (Figma / Stitch / v0 / Pencil / Claude)
72// into the project's DESIGN.md instead of overwriting tokens.json.
73// Round-trip semantic — preserves prose sections and comment
74// placement from the prose_hints argument.
75// 2. `pulp design` on save — captures the live editor's Theme state
76// back into DESIGN.md.
77//
78// This API is intentionally gated until anchor-stable IDs and 3-way merge
79// semantics are available. Until then, the function below throws a
80// reimport-safe design-loop gate error instead of writing partial output.
81
83 // Optional verbatim prose for each canonical section (Overview,
84 // Colors, Typography, Layout, Elevation & Depth, Shapes, Components,
85 // Do's and Don'ts). Unset keys produce auto-generated stub prose.
86 std::unordered_map<std::string, std::string> section_bodies;
87 // Optional name override; defaults to the theme's existing "name"
88 // string token if present.
89 std::string name_override;
90};
91
93std::string export_designmd(const Theme& theme,
94 const DesignMdProseHints& hints = {});
95
96} // namespace pulp::view
Export a Theme's design tokens to various output formats.
Definition design_export.hpp:24
static std::string to_json(const Theme &theme)
Export to JSON (round-trippable with Theme::from_json).
static std::string to_oklch_css(const Theme &theme, const std::string &prefix="pulp")
Export to OKLCH CSS color format.
static std::string to_cpp_header(const Theme &theme, const std::string &namespace_name)
Export to a C++ header with constexpr color/dimension values.
static std::string to_css(const Theme &theme, const std::string &prefix="pulp")
Export to CSS custom properties.
static std::string to_wgsl_uniforms(const Theme &theme, const std::string &struct_name="ThemeUniforms")
Export to GPU shader uniform declarations (WGSL).
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
std::string export_designmd(const Theme &theme, const DesignMdProseHints &hints={})
Export DESIGN.md text or throw while the DESIGN.md merge path is gated.
Definition design_export.hpp:82
std::string name_override
Definition design_export.hpp:89
std::unordered_map< std::string, std::string > section_bodies
Definition design_export.hpp:86
Definition theme.hpp:32