Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
jsx_lock.hpp
Go to the documentation of this file.
1#pragma once
2
53
54#include <optional>
55#include <string>
56#include <vector>
57
58namespace pulp::view {
59
66 std::string anchor_id;
71 std::string property_path;
76 std::string value;
77};
78
103
109 std::string source;
113 std::string property;
116 std::string message;
119 int line = 0;
120
122 bool mutated() const { return status == JsxLockStatus::patched; }
125 bool ok() const {
126 return status == JsxLockStatus::patched ||
128 }
129};
130
146std::optional<std::string>
147jsx_lock_property_to_key(const std::string& property_path);
148
155bool is_authored_jsx_source(const std::string& source);
156
176 const JsxLockTweak& tweak);
177
183std::vector<JsxLockResult>
184jsx_lock_tweaks_into_source(const std::string& source,
185 const std::vector<JsxLockTweak>& tweaks);
186
187} // namespace pulp::view
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
JsxLockResult jsx_lock_tweak_into_source(const std::string &source, const JsxLockTweak &tweak)
Locate the JSX element carrying data-pulp-anchor="<tweak.anchor_id>" in an authored JSX/TSX source st...
std::optional< std::string > jsx_lock_property_to_key(const std::string &property_path)
Map a dotted tweak property_path (paint.backgroundColor, style.width, layout.padding,...
std::vector< JsxLockResult > jsx_lock_tweaks_into_source(const std::string &source, const std::vector< JsxLockTweak > &tweaks)
Lock several tweaks into the same authored source in one pass.
bool is_authored_jsx_source(const std::string &source)
Heuristic guard: does source look like hand-authored JSX/TSX (as opposed to a Pulp-generated web-comp...
JsxLockStatus
Outcome status for a single JSX/TSX lock attempt.
Definition jsx_lock.hpp:80
@ already_current
The element and prop were found and the prop already held exactly value — source unchanged (idempoten...
Definition jsx_lock.hpp:85
@ anchor_not_found
No element carried data-pulp-anchor="<anchor_id>".
Definition jsx_lock.hpp:88
@ patched
The prop existed and its literal value was rewritten.
Definition jsx_lock.hpp:82
@ anchor_ambiguous
More than one element carried the same data-pulp-anchor.
Definition jsx_lock.hpp:91
@ too_dynamic
The element was found but the targeted prop is "too dynamic tolock" — its value is a spread,...
Definition jsx_lock.hpp:101
@ unsupported_property
Definition design_ir.hpp:702
Result of locking one tweak into an authored JSX/TSX source string.
Definition jsx_lock.hpp:105
std::string message
Human-readable summary, suitable for CLI / inspector display.
Definition jsx_lock.hpp:116
std::string source
The (possibly patched) source text.
Definition jsx_lock.hpp:109
bool mutated() const
True when the lock changed the source text.
Definition jsx_lock.hpp:122
bool ok() const
True when the element + prop were located and the source carries the value (already_current counts — ...
Definition jsx_lock.hpp:125
std::string property
The resolved style / prop key the path mapped to (camelCase, e.g.
Definition jsx_lock.hpp:113
int line
1-based line number of the patched value, or 0 when nothing was patched.
Definition jsx_lock.hpp:119
JsxLockStatus status
Definition jsx_lock.hpp:106
A single tweak to promote into authored JSX/TSX source.
Definition jsx_lock.hpp:63
std::string value
The tweaked value as it should appear in source.
Definition jsx_lock.hpp:76
std::string property_path
The canonical dotted property path used by pulp-tweaks.json (e.g.
Definition jsx_lock.hpp:71
std::string anchor_id
The tweak's stable_anchor_id — matched against the element's injected data-pulp-anchor="<id>" attribu...
Definition jsx_lock.hpp:66