Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
design_system.hpp
Go to the documentation of this file.
1#pragma once
2
3// pulp::design — the "Ink & Signal" design system, ingested into Pulp code so
4// the components a designer sees in the Figma library are directly usable when
5// building a real UI (a sampler, an effect, an app). This is the umbrella
6// include + the queryable component catalog.
7//
8// Two things live here:
9// 1. The catalog API — pull in <pulp/design/design_system.hpp> for the
10// component metadata and one-call theme helper. Audio widget declarations
11// are supplied by <pulp/view/audio_widgets.hpp> when Pulp::view-audio is
12// linked; keeping them out of this core header lets the extracted view
13// layer remain audio-free.
14// 2. The component CATALOG — rich, queryable metadata bridging each Figma
15// component to its native C++ class: category, native class, source header,
16// Figma component-set name, a one-line usage note, and the theme tokens it
17// restyles through. The catalog is what lets tooling (design-import,
18// JS/React bindings, docs) reason about the system without hardcoding it.
19//
20// The reskin contract still holds: every cataloged widget paints through
21// View::resolve_color, so applying a different theme restyles all of them with
22// no code change (see docs/guides/design-tokens.md).
23
24#include <pulp/view/theme.hpp>
25#include <pulp/view/view.hpp>
26
27// Generic component surface. Audio components are included by the audio target
28// through pulp/view/audio_widgets.hpp, not by this view-core header.
29#include <pulp/view/buttons.hpp>
31#include <pulp/view/widgets.hpp>
35#include <pulp/view/table.hpp>
36#include <pulp/view/toolbar.hpp>
48
49#include <string>
50#include <string_view>
51#include <vector>
52
53namespace pulp::design {
54
55// ── Theme helpers ───────────────────────────────────────────────────────────
56
62
65void apply_ink_signal(pulp::view::View& root, bool dark = true);
66
67// ── Component catalog ─────────────────────────────────────────────────────────
68
72inline constexpr std::string_view kFigmaFileKey = "q9iDYZzg86YrOQKr6I3bY0";
73
75enum class Category {
76 controls, // knobs, faders, sliders, steppers, pan
77 inputs, // text fields, combo boxes, toggles, checkboxes
78 indicators, // meters, progress, spinners, badges
79 navigation, // tabs, toolbars, breadcrumbs, sidebars, trees
80 containers, // panels, channel strips, scroll views, tables
81 overlays, // popovers, dialogs, tooltips, context menus, toasts
82 audio, // waveform, spectrum, XY pad, MIDI keyboard
83 feedback, // banners, empty states
84};
85
86std::string_view category_name(Category c);
87
91 std::string name; // Display + catalog key, matches Figma set name ("Knob")
93 std::string native_class; // Fully-qualified C++ class ("pulp::view::Knob")
94 std::string header; // Include needed to use it ("pulp/view/widgets.hpp")
95 std::string figma_component; // Figma component-set / page name in kFigmaFileKey
96 std::string usage; // One-line "what it's for"
97 std::vector<std::string> reskin_tokens; // Theme tokens it paints through
98};
99
101const std::vector<ComponentInfo>& catalog();
102
105const ComponentInfo* find(std::string_view name);
106
108std::vector<const ComponentInfo*> in_category(Category c);
109
110} // namespace pulp::design
Definition view.hpp:73
Pulp-drawn (Canvas/Skia) popup / context menu rendered in the view tree.
Definition analyzer_provider.hpp:12
Definition design_adherence.hpp:32
const ComponentInfo * find(std::string_view name)
Look up a component by its catalog name (case-sensitive, e.g.
void apply_ink_signal(pulp::view::View &root, bool dark=true)
Apply the Ink & Signal theme to a view tree root.
const std::vector< ComponentInfo > & catalog()
All cataloged components, in a stable display order.
constexpr std::string_view kFigmaFileKey
The Figma file that hosts the authored library (designer-facing editor).
Definition design_system.hpp:72
std::vector< const ComponentInfo * > in_category(Category c)
All components in a category, in catalog order.
std::string_view category_name(Category c)
pulp::view::Theme ink_signal_theme(bool dark=true)
The "Ink & Signal" theme for the requested appearance, token-true to the vendored bundle (assets/desi...
Category
Coarse grouping, mirrored from the Figma Overview page's 7 sections.
Definition design_system.hpp:75
@ feedback
Definition design_system.hpp:83
@ containers
Definition design_system.hpp:80
@ controls
Definition design_system.hpp:76
@ inputs
Definition design_system.hpp:77
@ indicators
Definition design_system.hpp:78
@ navigation
Definition design_system.hpp:79
@ overlays
Definition design_system.hpp:81
Standalone ScrollBar widget (pulp #6.3 in macos plugin-authoring plan).
SidePanel widget (pulp #6.3 in macos plugin-authoring plan).
One cataloged component: the bridge between a Figma component and its native C++ widget,...
Definition design_system.hpp:90
std::string figma_component
Definition design_system.hpp:95
std::string usage
Definition design_system.hpp:96
Category category
Definition design_system.hpp:92
std::string header
Definition design_system.hpp:94
std::string name
Definition design_system.hpp:91
std::string native_class
Definition design_system.hpp:93
std::vector< std::string > reskin_tokens
Definition design_system.hpp:97
Definition theme.hpp:32
Full-featured text editor widget with selection, clipboard, undo/redo.
Hierarchical tree display widget for file browsers, plugin lists, etc.
Additional UI components: ComboBox, Tooltip, ProgressBar, CallOutBox, TabPanel, ListBox,...