Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::design Namespace Reference

Classes

struct  AdherenceFinding
struct  GalleryCard
 One tagged card discovered by its leading @dsCard magic comment. More...
struct  HandoffScreen
 One screen the handoff describes: a display name, an optional relative path to its source (from a (path) after the name), and its exact-value specs (each a key/value bullet under the screen's heading). More...
struct  HandoffContract
 The parsed handoff contract. More...
struct  KnobWrite
 One parameter write a knob position produces. More...
struct  KnobPosition
 One selectable position of a knob. More...
struct  KnobSpec
 A declared knob: a stable id, a human label, its kind, and its positions in authored order (Slider positions are additionally sorted by at on parse). More...
struct  KnobSchema
 A design's declared set of knobs. More...
struct  KnobEffect
 The concrete effect of setting a knob to a value: its writes split by target. More...
struct  KnobApply
 The result of applying a knob to a design artifact. More...
struct  LedgerAsset
 One recorded artifact revision. More...
struct  DesignLedger
 The whole project ledger: a format id plus the recorded assets. More...
struct  ManifestToken
 One token in the compiled allowlist: a name an importer/codegen may bind to, its kind, and its value in the chosen appearance. More...
struct  ManifestComponent
 One component contract: a widget an importer may target and the exact theme tokens it legitimately paints through (its reskin allowlist). More...
struct  DesignManifest
 The compiled design contract. More...
struct  ComponentInfo
 One cataloged component: the bridge between a Figma component and its native C++ widget, plus enough metadata for tooling and docs to use it well. More...
struct  TweakParam
 One parameter in the block: a key and its JSON-encoded value. More...
struct  EditBlockSpan
 Where the block sits in the host text, as byte offsets. More...
struct  RewriteResult
 Result of a rewrite: the new full artifact text plus whether anything outside the block changed (it must not — this is a self-check the caller can assert). More...
struct  VariantProperty
 One property parsed from a variant name: "Size=Large" -> {"Size","Large"}. More...
struct  ContractProp
 One property in the synthesized contract: its name, the sorted-unique value set observed across the set (its enum), and the chosen default value. More...
struct  VariantIssue
 A named issue about a variant set that could not be cleanly collapsed. More...
struct  ComponentContract
 The typed component contract synthesized from a variant set. More...

Enumerations

enum class  AdherenceSeverity { error , warning , info }
enum class  AdherenceKind { raw_color , unknown_token , raw_dimension }
enum class  FidelityIntent { unspecified , hifi , lofi }
 The implementer intent the handoff declares for the screens. More...
enum class  KnobKind { Slider , Toggle , Enum }
 The kind of control a knob presents. More...
enum class  WriteTarget { ThemeToken , LocalBlock }
 Where a resolved write lands. More...
enum class  ReviewStatus { needs_review , approved , changes_requested }
 Where an asset stands in review. More...
enum class  Category {
  controls , inputs , indicators , navigation ,
  containers , overlays , audio , feedback
}
 Coarse grouping, mirrored from the Figma Overview page's 7 sections. More...

Functions

const char * adherence_kind_name (AdherenceKind kind)
 Human-readable kind slug ("raw-color", "unknown-token", "raw-dimension").
std::vector< AdherenceFinding > lint_adherence (const std::string &js_source, const DesignManifest &manifest)
 Lint UI JS against a compiled design contract.
std::optional< GalleryCard > parse_gallery_card (std::string_view file_head, std::string_view path)
 Parse the leading magic comments of one source file.
std::string gallery_content_hash (std::string_view bytes)
 Deterministic 64-bit FNV-1a hash (lowercase hex) of a card's source bytes.
void sort_cards (std::vector< GalleryCard > &cards)
 Stable order: by group, then by file. The gallery diffs cleanly across passes.
std::string gallery_manifest_json (const std::vector< GalleryCard > &cards, const std::function< std::string(const GalleryCard &)> &png_rel)
 Deterministic JSON manifest: format_version, a total, and one entry per group (sorted, with a per-group count) listing its cards.
std::string gallery_html (const std::vector< GalleryCard > &cards, const std::function< std::string(const GalleryCard &)> &png_rel)
 Self-contained HTML review page: one section per group, each card shown at its declared viewport with its rendered PNG (via png_rel) and a starting-point badge.
std::string_view fidelity_intent_name (FidelityIntent intent)
 Stable lowercase slug for a fidelity intent ("hifi" | "lofi" | "unspecified").
FidelityIntent fidelity_intent_from_text (std::string_view text)
 Parse a fidelity value as written in a handoff README ("hi-fi", "high", "pixel-perfect", "lo-fi", "restyle", …).
HandoffContract parse_handoff_readme (std::string_view markdown, std::string_view source)
 Parse a handoff README (Markdown) into a contract.
void merge_design_systems (HandoffContract &contract, const std::vector< std::string > &slugs)
 Merge design-system slugs discovered on disk (the _ds/<slug>/ directory names) into an already-parsed contract, keeping design_systems sorted+unique.
std::string handoff_contract_json (const HandoffContract &contract)
 Serialize a contract to deterministic JSON for the import report.
std::optional< KnobSchema > parse_knob_schema (std::string_view json)
 Parse a declared knob schema from JSON.
std::string knob_schema_to_json (const KnobSchema &schema)
 Serialize a schema to stable JSON.
const KnobSpec * find_knob (const KnobSchema &schema, std::string_view id)
 Look up a knob by id (nullptr when absent).
const KnobPosition * select_position (const KnobSpec &knob, std::string_view value)
 Select the position of knob for value:
WriteTarget classify_write (const KnobWrite &write, const std::vector< std::string > &theme_tokens)
 Classify a write against the design's bound theme tokens: ThemeToken iff write.key is one of theme_tokens, else LocalBlock.
std::optional< KnobEffect > resolve_knob (const KnobSpec &knob, std::string_view value, const std::vector< std::string > &theme_tokens)
 Resolve knob set to value into its split writes against theme_tokens.
std::optional< KnobApply > apply_knob (std::string_view artifact, const KnobSpec &knob, std::string_view value, const std::vector< std::string > &theme_tokens)
 Apply knob set to value to a design artifact: persist the local writes into the artifact's EDITMODE block (updating keys in place, appending new ones, preserving every byte outside the block) and hand back the token writes for the caller to apply at the theme layer.
KnobSpec builtin_theme_flip ()
 Built-in theme-flip knob: an Enum over appearance with "light"/"dark" positions, each writing a local appearance param.
const char * review_status_name (ReviewStatus status)
 Canonical lowercase slug for a status ("needs-review" | "approved" | "changes-requested").
std::optional< ReviewStatus > review_status_from_name (std::string_view name)
 Parse a status slug; std::nullopt if it is not one of the three.
DesignLedger parse_ledger (const std::string &json)
 Parse a ledger from JSON.
std::string ledger_to_json (const DesignLedger &ledger)
 Serialize a ledger to deterministic JSON (assets sorted, fixed key order, design_systems sorted).
LedgerAsset & upsert_asset (DesignLedger &ledger, const LedgerAsset &incoming)
 Record or update an asset.
std::vector< std::string > remove_asset (DesignLedger &ledger, const std::string &selector)
 Remove a specific asset.
std::vector< std::string > reconcile (DesignLedger &ledger, const std::function< bool(const std::string &path)> &exists)
 Drop assets whose file no longer exists, per the caller-supplied predicate (the "ledger vs reality" reconciler for hand-deleted files).
DesignManifest compile_design_manifest (const pulp::view::Theme &theme, const std::vector< ComponentInfo > &components, std::string source, std::string appearance)
 Compile a manifest from an explicit theme + component set.
DesignManifest compile_ink_signal_manifest (bool dark=false)
 Compile from the built-in Ink & Signal system: its theme for the requested appearance plus the full component catalog.
std::string manifest_to_json (const DesignManifest &manifest)
 Serialize to stable, pretty JSON.
DesignManifest manifest_from_json (const std::string &json)
 Parse a manifest back from the JSON that manifest_to_json produces.
std::string emit_binding_prompt (const DesignManifest &manifest)
 Emit an LLM-ready binding prompt (Markdown): the closed token allowlist and the component contracts, with an explicit adherence directive.
pulp::view::Theme ink_signal_theme (bool dark=true)
 The "Ink & Signal" theme for the requested appearance, token-true to the vendored bundle (assets/design-system/ink-signal/).
void apply_ink_signal (pulp::view::View &root, bool dark=true)
 Apply the Ink & Signal theme to a view tree root.
std::string_view category_name (Category c)
const std::vector< ComponentInfo > & catalog ()
 All cataloged components, in a stable display order.
const ComponentInfo * find (std::string_view name)
 Look up a component by its catalog name (case-sensitive, e.g.
std::vector< const ComponentInfo * > in_category (Category c)
 All components in a category, in catalog order.
std::optional< EditBlockSpan > find_edit_block (std::string_view text)
 Locate the first edit block in text.
std::optional< std::vector< TweakParam > > read_edit_block (std::string_view text)
 Parse the parameters out of text's edit block.
std::optional< std::string > edit_block_payload (const std::vector< TweakParam > &params)
 Serialize parameters to the canonical single-line block payload (no outer markers): {"k1":v1,"k2":v2}.
std::optional< RewriteResult > rewrite_edit_block (std::string_view text, const std::vector< TweakParam > &params)
 Rewrite text's edit block so its payload encodes params, preserving every byte outside the marker span exactly.
std::optional< RewriteResult > set_edit_param (std::string_view text, std::string_view key, std::string_view json_value)
 Apply a single key=value change to text's block: update the key in place if present, else append it (preserving the order of existing keys).
std::vector< VariantProperty > parse_variant_name (std::string_view name)
 Parse a component-set variant name ("Size=Large, State=Hover") into ordered properties.
ComponentContract build_component_contract (std::string_view component, const std::vector< std::string > &variant_names)
 Build a contract from a component-set name and its member variant names.
std::string component_contract_json (const ComponentContract &contract)
 Serialize a contract to deterministic JSON (feeds R1's manifest / R2's lint).
std::unique_ptr< pulp::view::View > build_sampler_starter (const pulp::view::Theme &theme)

Variables

constexpr std::string_view kGalleryFormatVersion = "2026.07-design-gallery-v1"
 Format id stamped into the manifest JSON; bump on a non-additive shape change.
constexpr std::string_view kGalleryUngrouped = "ungrouped"
 The group a card falls into when its tag omits group=.
constexpr std::string_view kHandoffFormatVersion = "2026.07-design-handoff-v1"
 Format id stamped into the contract; bump on a non-additive shape change.
constexpr std::string_view kDesignLedgerVersion = "2026.07-design-ledger-v1"
 On-disk format id stamped into DesignLedger::ledger_version; bump on a non-additive shape change.
constexpr std::string_view kManifestVersion = "2026.07-design-manifest-v1"
 The on-disk format identifier stamped into DesignManifest::manifest_version.
constexpr std::string_view kFigmaFileKey = "q9iDYZzg86YrOQKr6I3bY0"
 The Figma file that hosts the authored library (designer-facing editor).
constexpr std::string_view kEditBlockBegin = "/*EDITMODE-BEGIN*/"
 The exact opening and closing markers that anchor the block.
constexpr std::string_view kEditBlockEnd = "/*EDITMODE-END*/"
constexpr std::string_view kVariantContractVersion = "2026.07-variant-contract-v1"
 Format id stamped into the contract; bump on a non-additive shape change.
constexpr float kSamplerWidth = 720.0f
constexpr float kSamplerHeight = 440.0f

Enumeration Type Documentation

◆ AdherenceKind

enum class pulp::design::AdherenceKind
strong
Enumerator
raw_color 
unknown_token 
raw_dimension 

◆ AdherenceSeverity

Enumerator
error 
warning 
info 

◆ Category

enum class pulp::design::Category
strong

Coarse grouping, mirrored from the Figma Overview page's 7 sections.

Enumerator
controls 
inputs 
indicators 
navigation 
containers 
overlays 
audio 
feedback 

◆ FidelityIntent

enum class pulp::design::FidelityIntent
strong

The implementer intent the handoff declares for the screens.

Enumerator
unspecified 

no declaration found — the importer must ask or default

hifi 

recreate pixel-for-pixel (the design IS the spec)

lofi 

restyle into the target design system (adapt, don't trace)

◆ KnobKind

enum class pulp::design::KnobKind
strong

The kind of control a knob presents.

It changes only how a value selects a position (see select_position); the resolved writes are identical machinery.

Enumerator
Slider 
Toggle 
Enum 

◆ ReviewStatus

enum class pulp::design::ReviewStatus
strong

Where an asset stands in review.

A closed set — no free-text status — so a consumer can branch on it reliably (e.g. never regenerate an approved version).

Enumerator
needs_review 
approved 
changes_requested 

◆ WriteTarget

enum class pulp::design::WriteTarget
strong

Where a resolved write lands.

Enumerator
ThemeToken 
LocalBlock 

Function Documentation

◆ adherence_kind_name()

const char * pulp::design::adherence_kind_name ( AdherenceKind kind)

Human-readable kind slug ("raw-color", "unknown-token", "raw-dimension").

◆ apply_ink_signal()

void pulp::design::apply_ink_signal ( pulp::view::View & root,
bool dark = true )

Apply the Ink & Signal theme to a view tree root.

Descendants resolve their colors up the parent chain, so one call restyles the whole subtree.

◆ apply_knob()

std::optional< KnobApply > pulp::design::apply_knob ( std::string_view artifact,
const KnobSpec & knob,
std::string_view value,
const std::vector< std::string > & theme_tokens )

Apply knob set to value to a design artifact: persist the local writes into the artifact's EDITMODE block (updating keys in place, appending new ones, preserving every byte outside the block) and hand back the token writes for the caller to apply at the theme layer.

Returns nullopt when value selects no position, when a local write is not serializable (e.g. a non-UTF-8 key), or when there are local writes to make but the artifact has no well-formed EDITMODE block to anchor them. When the value resolves to token writes only, the artifact is returned unchanged (no block is required) alongside those token writes.

◆ build_component_contract()

ComponentContract pulp::design::build_component_contract ( std::string_view component,
const std::vector< std::string > & variant_names )

Build a contract from a component-set name and its member variant names.

Default value per property, in priority order:

  1. an explicit "Default" value if the enum contains one (case-insensitive);
  2. for a boolean-shaped enum ({On,Off}/{True,False}/{Yes,No}) the falsey one;
  3. otherwise the value that appears in the most variants (ties: sorted first).

◆ build_sampler_starter()

std::unique_ptr< pulp::view::View > pulp::design::build_sampler_starter ( const pulp::view::Theme & theme)

◆ builtin_theme_flip()

KnobSpec pulp::design::builtin_theme_flip ( )

Built-in theme-flip knob: an Enum over appearance with "light"/"dark" positions, each writing a local appearance param.

Appearance is a mode the host recompiles the token set for, not a single token, so its write is local by construction — which makes this the one archetype that is fully general across designs and needs no per-design authoring. Minimalism and layout-variant knobs are design-specific token bundles and ship as authored schema, not built-ins.

◆ catalog()

const std::vector< ComponentInfo > & pulp::design::catalog ( )

All cataloged components, in a stable display order.

◆ category_name()

std::string_view pulp::design::category_name ( Category c)

◆ classify_write()

WriteTarget pulp::design::classify_write ( const KnobWrite & write,
const std::vector< std::string > & theme_tokens )

Classify a write against the design's bound theme tokens: ThemeToken iff write.key is one of theme_tokens, else LocalBlock.

A caller with a DesignManifest passes the token names (manifest.tokens[*].name).

◆ compile_design_manifest()

DesignManifest pulp::design::compile_design_manifest ( const pulp::view::Theme & theme,
const std::vector< ComponentInfo > & components,
std::string source,
std::string appearance )

Compile a manifest from an explicit theme + component set.

source and appearance are recorded as provenance; the token values come from theme.

◆ compile_ink_signal_manifest()

DesignManifest pulp::design::compile_ink_signal_manifest ( bool dark = false)

Compile from the built-in Ink & Signal system: its theme for the requested appearance plus the full component catalog.

◆ component_contract_json()

std::string pulp::design::component_contract_json ( const ComponentContract & contract)

Serialize a contract to deterministic JSON (feeds R1's manifest / R2's lint).

◆ edit_block_payload()

std::optional< std::string > pulp::design::edit_block_payload ( const std::vector< TweakParam > & params)

Serialize parameters to the canonical single-line block payload (no outer markers): {"k1":v1,"k2":v2}.

Keys are emitted in the given order. Each value is normalized to exactly one JSON value, so a stored value cannot smuggle a marker or extra structure into the block. Empty params serialize {}. Returns nullopt when a key is not valid UTF-8 or a value is not exactly one JSON value.

◆ emit_binding_prompt()

std::string pulp::design::emit_binding_prompt ( const DesignManifest & manifest)

Emit an LLM-ready binding prompt (Markdown): the closed token allowlist and the component contracts, with an explicit adherence directive.

This is the text an importer/codegen prompt embeds so generated UI binds only to real tokens and widgets.

◆ fidelity_intent_from_text()

FidelityIntent pulp::design::fidelity_intent_from_text ( std::string_view text)

Parse a fidelity value as written in a handoff README ("hi-fi", "high", "pixel-perfect", "lo-fi", "restyle", …).

Returns unspecified for anything unrecognized so a typo never silently becomes the wrong intent.

◆ fidelity_intent_name()

std::string_view pulp::design::fidelity_intent_name ( FidelityIntent intent)

Stable lowercase slug for a fidelity intent ("hifi" | "lofi" | "unspecified").

◆ find()

const ComponentInfo * pulp::design::find ( std::string_view name)

Look up a component by its catalog name (case-sensitive, e.g.

"Knob"). Returns nullptr if absent.

◆ find_edit_block()

std::optional< EditBlockSpan > pulp::design::find_edit_block ( std::string_view text)

Locate the first edit block in text.

The payload between the markers must be exactly one balanced JSON object followed only by whitespace and the closing marker. Returns nullopt when there is no opening marker, no valid object at the payload, trailing bytes after the object before the marker, or no closing marker. The object scan is string-aware, so a value that itself contains the literal end-marker text does not truncate the block.

◆ find_knob()

const KnobSpec * pulp::design::find_knob ( const KnobSchema & schema,
std::string_view id )

Look up a knob by id (nullptr when absent).

◆ gallery_content_hash()

std::string pulp::design::gallery_content_hash ( std::string_view bytes)

Deterministic 64-bit FNV-1a hash (lowercase hex) of a card's source bytes.

The render cache is keyed on (file, viewport, this hash): unchanged source at an unchanged viewport reuses the prior PNG instead of re-rendering. Exposed so the CLI and the tests share exactly one algorithm.

◆ gallery_html()

std::string pulp::design::gallery_html ( const std::vector< GalleryCard > & cards,
const std::function< std::string(const GalleryCard &)> & png_rel )

Self-contained HTML review page: one section per group, each card shown at its declared viewport with its rendered PNG (via png_rel) and a starting-point badge.

No external assets or scripts, so it opens straight from disk. A card whose png_rel is empty renders a "not rendered" placeholder rather than a broken image.

◆ gallery_manifest_json()

std::string pulp::design::gallery_manifest_json ( const std::vector< GalleryCard > & cards,
const std::function< std::string(const GalleryCard &)> & png_rel )

Deterministic JSON manifest: format_version, a total, and one entry per group (sorted, with a per-group count) listing its cards.

png_rel(card) yields the rendered PNG path recorded for a card, or "" when it was not rendered — this function itself touches no filesystem.

◆ handoff_contract_json()

std::string pulp::design::handoff_contract_json ( const HandoffContract & contract)

Serialize a contract to deterministic JSON for the import report.

◆ in_category()

std::vector< const ComponentInfo * > pulp::design::in_category ( Category c)

All components in a category, in catalog order.

◆ ink_signal_theme()

pulp::view::Theme pulp::design::ink_signal_theme ( bool dark = true)

The "Ink & Signal" theme for the requested appearance, token-true to the vendored bundle (assets/design-system/ink-signal/).

Equivalent to theme_from_preset(*find_preset("ink-signal"), dark) but without the caller needing to know the preset id.

◆ knob_schema_to_json()

std::string pulp::design::knob_schema_to_json ( const KnobSchema & schema)

Serialize a schema to stable JSON.

Round-trips with parse_knob_schema: parse(to_json(s)) yields an equivalent schema.

◆ ledger_to_json()

std::string pulp::design::ledger_to_json ( const DesignLedger & ledger)

Serialize a ledger to deterministic JSON (assets sorted, fixed key order, design_systems sorted).

Stamps kDesignLedgerVersion.

◆ lint_adherence()

std::vector< AdherenceFinding > pulp::design::lint_adherence ( const std::string & js_source,
const DesignManifest & manifest )

Lint UI JS against a compiled design contract.

Findings are returned in source order (by line, then column). An empty result means the JS binds cleanly to the contract.

◆ manifest_from_json()

DesignManifest pulp::design::manifest_from_json ( const std::string & json)

Parse a manifest back from the JSON that manifest_to_json produces.

Missing or malformed fields degrade to empty/default rather than throwing, so a partial file still yields a usable (if smaller) contract. Round-trips: manifest_from_json(manifest_to_json(m)) preserves tokens and components.

◆ manifest_to_json()

std::string pulp::design::manifest_to_json ( const DesignManifest & manifest)

Serialize to stable, pretty JSON.

Object keys and array order are fixed so the output is byte-deterministic for a given manifest.

◆ merge_design_systems()

void pulp::design::merge_design_systems ( HandoffContract & contract,
const std::vector< std::string > & slugs )

Merge design-system slugs discovered on disk (the _ds/<slug>/ directory names) into an already-parsed contract, keeping design_systems sorted+unique.

Lets the CLI fold folder structure into a README-derived contract.

◆ parse_gallery_card()

std::optional< GalleryCard > pulp::design::parse_gallery_card ( std::string_view file_head,
std::string_view path )

Parse the leading magic comments of one source file.

file_head is the first few lines (the CLI reads a bounded prefix). Returns nullopt when there is no @dsCard tag carrying a valid viewport=WxH — an untagged or malformed file is simply not a card, never an error. group= is optional (defaults to kGalleryUngrouped); @startingPoint anywhere in the head sets the flag. The returned card's content_hash is left empty for the caller to fill.

◆ parse_handoff_readme()

HandoffContract pulp::design::parse_handoff_readme ( std::string_view markdown,
std::string_view source )

Parse a handoff README (Markdown) into a contract.

source is recorded verbatim for provenance. Recognizes, case-insensitively and tolerantly:

  • a Fidelity: line (or a ## Fidelity heading) -> fidelity
  • a Bound to:/Design system: line -> design_systems
  • a ## Screens section whose ### headings are screens, with - k: v bullets as specs and an optional (relative/path) after the name
  • a ## Tokens Markdown table (| Token | Value |) -> tokens
  • a ## Interactions/## States section's bullets -> interactions

◆ parse_knob_schema()

std::optional< KnobSchema > pulp::design::parse_knob_schema ( std::string_view json)

Parse a declared knob schema from JSON.

Shape: {"knobs":[{"id","label","kind":"slider|toggle|enum", "positions":[{"label","at",writes:[{"key","value"}]}]}]} Degrades: unknown object members are ignored; a knob missing an id, or a position/write missing its key, is skipped rather than throwing. Returns nullopt only on a hard shape error: the top level is not an object, or has no "knobs" array.

◆ parse_ledger()

DesignLedger pulp::design::parse_ledger ( const std::string & json)

Parse a ledger from JSON.

Tolerant: empty input or a shape it does not recognize yields an empty ledger (so a first record bootstraps cleanly) rather than throwing. Unknown status slugs fall back to needs_review.

◆ parse_variant_name()

std::vector< VariantProperty > pulp::design::parse_variant_name ( std::string_view name)

Parse a component-set variant name ("Size=Large, State=Hover") into ordered properties.

Names and values are trimmed. A comma segment with no '=' is skipped here (the contract builder records it as a malformed-name issue).

◆ read_edit_block()

std::optional< std::vector< TweakParam > > pulp::design::read_edit_block ( std::string_view text)

Parse the parameters out of text's edit block.

Returns nullopt when there is no well-formed block, its payload is not a JSON object, or the object has a duplicate key (a JSON object may not repeat a key — the parser rejects it). Object member order is preserved: it is the order the rewriter re-emits.

◆ reconcile()

std::vector< std::string > pulp::design::reconcile ( DesignLedger & ledger,
const std::function< bool(const std::string &path)> & exists )

Drop assets whose file no longer exists, per the caller-supplied predicate (the "ledger vs reality" reconciler for hand-deleted files).

Returns the "name@version" slugs removed.

◆ remove_asset()

std::vector< std::string > pulp::design::remove_asset ( DesignLedger & ledger,
const std::string & selector )

Remove a specific asset.

name alone drops every version of that name; "name@version" drops just that revision. Returns the slugs actually removed.

◆ resolve_knob()

std::optional< KnobEffect > pulp::design::resolve_knob ( const KnobSpec & knob,
std::string_view value,
const std::vector< std::string > & theme_tokens )

Resolve knob set to value into its split writes against theme_tokens.

Returns nullopt when value selects no position.

◆ review_status_from_name()

std::optional< ReviewStatus > pulp::design::review_status_from_name ( std::string_view name)

Parse a status slug; std::nullopt if it is not one of the three.

◆ review_status_name()

const char * pulp::design::review_status_name ( ReviewStatus status)

Canonical lowercase slug for a status ("needs-review" | "approved" | "changes-requested").

Stable across releases; used in JSON and CLI output.

◆ rewrite_edit_block()

std::optional< RewriteResult > pulp::design::rewrite_edit_block ( std::string_view text,
const std::vector< TweakParam > & params )

Rewrite text's edit block so its payload encodes params, preserving every byte outside the marker span exactly.

Returns nullopt when text has no well-formed block (there is nothing to anchor a rewrite to). The markers themselves are preserved; only the bytes between them are replaced.

◆ select_position()

const KnobPosition * pulp::design::select_position ( const KnobSpec & knob,
std::string_view value )

Select the position of knob for value:

  • Slider — value is parsed as a number and the position with the nearest at is chosen; a non-numeric value selects nothing.
  • Toggle / Enum — value is matched against a position label (case-sensitive); failing that, against a 0-based position index. Returns nullptr when the knob has no positions or value selects none.

◆ set_edit_param()

std::optional< RewriteResult > pulp::design::set_edit_param ( std::string_view text,
std::string_view key,
std::string_view json_value )

Apply a single key=value change to text's block: update the key in place if present, else append it (preserving the order of existing keys).

json_value is the value's JSON text (quote strings yourself). Returns nullopt when there is no well-formed block. A convenience over read + mutate + rewrite.

◆ sort_cards()

void pulp::design::sort_cards ( std::vector< GalleryCard > & cards)

Stable order: by group, then by file. The gallery diffs cleanly across passes.

◆ upsert_asset()

LedgerAsset & pulp::design::upsert_asset ( DesignLedger & ledger,
const LedgerAsset & incoming )

Record or update an asset.

If incoming.version is empty, the next version for that name is assigned ("v1", "v2", …); if it names an existing (name, version) the entry is replaced. design_systems is sorted+deduped. Returns a reference to the stored entry. The ledger stays sorted afterward.

Variable Documentation

◆ kDesignLedgerVersion

std::string_view pulp::design::kDesignLedgerVersion = "2026.07-design-ledger-v1"
inlineconstexpr

On-disk format id stamped into DesignLedger::ledger_version; bump on a non-additive shape change.

◆ kEditBlockBegin

std::string_view pulp::design::kEditBlockBegin = "/*EDITMODE-BEGIN*/"
inlineconstexpr

The exact opening and closing markers that anchor the block.

Fixed strings — a change here is a format break, not a tuning knob.

◆ kEditBlockEnd

std::string_view pulp::design::kEditBlockEnd = "/*EDITMODE-END*/"
inlineconstexpr

◆ kFigmaFileKey

std::string_view pulp::design::kFigmaFileKey = "q9iDYZzg86YrOQKr6I3bY0"
inlineconstexpr

The Figma file that hosts the authored library (designer-facing editor).

The in-repo tokens + native widgets are the buildable source of truth; this is the cross-reference for round-tripping a reskin back to design.

◆ kGalleryFormatVersion

std::string_view pulp::design::kGalleryFormatVersion = "2026.07-design-gallery-v1"
inlineconstexpr

Format id stamped into the manifest JSON; bump on a non-additive shape change.

◆ kGalleryUngrouped

std::string_view pulp::design::kGalleryUngrouped = "ungrouped"
inlineconstexpr

The group a card falls into when its tag omits group=.

◆ kHandoffFormatVersion

std::string_view pulp::design::kHandoffFormatVersion = "2026.07-design-handoff-v1"
inlineconstexpr

Format id stamped into the contract; bump on a non-additive shape change.

◆ kManifestVersion

std::string_view pulp::design::kManifestVersion = "2026.07-design-manifest-v1"
inlineconstexpr

The on-disk format identifier stamped into DesignManifest::manifest_version.

Bump when the manifest JSON shape changes in a non-additive way.

◆ kSamplerHeight

float pulp::design::kSamplerHeight = 440.0f
inlineconstexpr

◆ kSamplerWidth

float pulp::design::kSamplerWidth = 720.0f
inlineconstexpr

◆ kVariantContractVersion

std::string_view pulp::design::kVariantContractVersion = "2026.07-variant-contract-v1"
inlineconstexpr

Format id stamped into the contract; bump on a non-additive shape change.