6#include <portals/detail/pss_data.hpp>
8namespace portals::detail {
34constexpr bool pssGlyphProperty(
PssProperty property)
noexcept {
41constexpr std::size_t pssGlyphIndex(
PssProperty property)
noexcept {
45inline constexpr std::string_view PSS_ROLE_PROPERTY_PREFIX =
"role-";
47constexpr bool pssRoleProperty(
PssProperty property)
noexcept {
51inline void assignPssRole(
PssProperty property, PssScalarValue value, std::string_view name,
52 std::vector<StyleRolePatch> &patches) {
54 if (patch == patches.end()) {
55 patches.emplace_back();
56 patches.back().name.assign(name);
57 patch = patches.end() - 1;
61 patch->paint.foreground = value.color;
64 patch->paint.background = value.color;
67 patch->paint.bold = value.boolean;
70 patch->paint.italic = value.boolean;
73 patch->paint.underline = value.boolean;
83inline void freezePssRoles(PssDocument &document) {
84 for (
auto &rule : document.sheet.rules) {
86 rule.roles = std::make_shared<const std::vector<StyleRolePatch>>(*
rule.roles);
89 for (
auto &declaration : document.declarations) {
90 if (declaration.roleName) {
91 declaration.roleName = std::make_shared<const std::string>(*declaration.roleName);
97inline constexpr std::array<std::string_view, PSS_PROPERTY_COUNT> PSS_PROPERTY_NAMES{
104 "frame-line-foreground",
105 "frame-line-background",
108 "frame-line-underline",
109 "frame-title-foreground",
110 "frame-title-background",
112 "frame-title-italic",
113 "frame-title-underline",
114 "frame-ends-foreground",
115 "frame-ends-background",
118 "frame-ends-underline",
119 "scrollbar-track-foreground",
120 "scrollbar-track-background",
121 "scrollbar-track-bold",
122 "scrollbar-track-italic",
123 "scrollbar-track-underline",
124 "scrollbar-thumb-foreground",
125 "scrollbar-thumb-background",
126 "scrollbar-thumb-bold",
127 "scrollbar-thumb-italic",
128 "scrollbar-thumb-underline",
129 "scrollbar-ends-foreground",
130 "scrollbar-ends-background",
131 "scrollbar-ends-bold",
132 "scrollbar-ends-italic",
133 "scrollbar-ends-underline",
134 "scrollbar-arrows-foreground",
135 "scrollbar-arrows-background",
136 "scrollbar-arrows-bold",
137 "scrollbar-arrows-italic",
138 "scrollbar-arrows-underline",
139 "scrollbar-corner-foreground",
140 "scrollbar-corner-background",
141 "scrollbar-corner-bold",
142 "scrollbar-corner-italic",
143 "scrollbar-corner-underline",
144 "scrollbar-track-pattern",
145 "scrollbar-thumb-pattern",
146 "scrollbar-arrow-pattern",
147 "scrollbar-thumb-start-foreground",
148 "scrollbar-thumb-start-background",
149 "scrollbar-thumb-start-bold",
150 "scrollbar-thumb-start-italic",
151 "scrollbar-thumb-start-underline",
152 "scrollbar-thumb-body-foreground",
153 "scrollbar-thumb-body-background",
154 "scrollbar-thumb-body-bold",
155 "scrollbar-thumb-body-italic",
156 "scrollbar-thumb-body-underline",
157 "scrollbar-thumb-end-foreground",
158 "scrollbar-thumb-end-background",
159 "scrollbar-thumb-end-bold",
160 "scrollbar-thumb-end-italic",
161 "scrollbar-thumb-end-underline",
162 "scrollbar-thumb-single-foreground",
163 "scrollbar-thumb-single-background",
164 "scrollbar-thumb-single-bold",
165 "scrollbar-thumb-single-italic",
166 "scrollbar-thumb-single-underline",
167 "slider-track-foreground",
168 "slider-track-background",
170 "slider-track-italic",
171 "slider-track-underline",
172 "slider-fill-foreground",
173 "slider-fill-background",
175 "slider-fill-italic",
176 "slider-fill-underline",
177 "slider-thumb-foreground",
178 "slider-thumb-background",
180 "slider-thumb-italic",
181 "slider-thumb-underline",
184 "scrollbar-horizontal-track-glyph",
185 "scrollbar-horizontal-thumb-glyph",
186 "scrollbar-horizontal-start-glyph",
187 "scrollbar-horizontal-end-glyph",
188 "scrollbar-horizontal-backward-glyph",
189 "scrollbar-horizontal-forward-glyph",
190 "scrollbar-horizontal-thumb-start-glyph",
191 "scrollbar-horizontal-thumb-body-glyph",
192 "scrollbar-horizontal-thumb-end-glyph",
193 "scrollbar-horizontal-thumb-single-glyph",
194 "scrollbar-vertical-track-glyph",
195 "scrollbar-vertical-thumb-glyph",
196 "scrollbar-vertical-start-glyph",
197 "scrollbar-vertical-end-glyph",
198 "scrollbar-vertical-backward-glyph",
199 "scrollbar-vertical-forward-glyph",
200 "scrollbar-vertical-thumb-start-glyph",
201 "scrollbar-vertical-thumb-body-glyph",
202 "scrollbar-vertical-thumb-end-glyph",
203 "scrollbar-vertical-thumb-single-glyph",
204 "scrollbar-corner-glyph",
216inline constexpr std::array<std::string_view, 6> PSS_STATE_NAMES{
"normal",
"focused",
"disabled",
217 "selected",
"header",
"caret"};
225constexpr PssError pssError(
PssErrorCode code, PssLocation location, std::string_view message,
226 std::string_view subject = {}) {
230 result.location = location;
231 result.message = message;
232 result.subjectSize = std::min(subject.size(), result.subject.size());
233 result.subjectTruncated = subject.size() > result.subject.size();
235 for (std::size_t index = 0; index < result.subjectSize; ++index) {
236 const auto value =
static_cast<unsigned char>(subject[index]);
238 result.subject[index] = value >= 32 && value < 127 ? subject[index] :
'?';
247constexpr void pssAdvance(PssLocation &location,
char value) {
262constexpr std::expected<void, PssError> validatePssUtf8(std::string_view source) {
263 PssLocation location;
265 while (location.offset < source.size()) {
266 const auto first =
static_cast<unsigned char>(source[location.offset]);
273 pssAdvance(location, source[location.offset]);
278 const auto begin = location;
280 unsigned codepoint{};
283 if (first >= 0xc2 && first <= 0xdf) {
285 codepoint = first & 0x1f;
287 }
else if (first >= 0xe0 && first <= 0xef) {
289 codepoint = first & 0x0f;
291 }
else if (first >= 0xf0 && first <= 0xf4) {
293 codepoint = first & 0x07;
299 if (count > source.size() - location.offset) {
303 for (std::size_t index = 1; index < count; ++index) {
304 const auto value =
static_cast<unsigned char>(source[location.offset + index]);
306 if (value < 0x80 || value > 0xbf) {
310 codepoint = (codepoint << 6) | (value & 0x3f);
313 if (codepoint < minimum || codepoint > 0x10ffff || (codepoint >= 0xd800 && codepoint <= 0xdfff)) {
317 for (std::size_t index = 0; index < count; ++index) {
318 pssAdvance(location, source[location.offset]);
328constexpr bool pssLetter(
char value) {
329 return (value >=
'a' && value <=
'z') || (value >=
'A' && value <=
'Z') || value ==
'_';
335constexpr bool pssDigit(
char value) {
336 return value >=
'0' && value <=
'9';
342constexpr bool pssSpace(
char value) {
343 return value ==
' ' || value ==
'\t' || value ==
'\r' || value ==
'\n';
349constexpr bool isPssIdentifier(std::string_view name) {
350 if (name.empty() || !pssLetter(name.front())) {
354 for (
const auto value : name.substr(1)) {
355 if (!pssLetter(value) && !pssDigit(value) && value !=
'-') {
378 : source_(source), sourceData_(source.data()), sourceSize_(source.size()), sink_(sink), policy_(policy),
379 maxBytes_(maxBytes), maxRules_(maxRules) {
383 constexpr std::expected<void, PssError>
parse() {
384 if (source_.size() > maxBytes_) {
388 if (policy_ == PssPolicy::STRICT_UTF8) {
389 auto valid = validatePssUtf8(source_);
395 if (source_.starts_with(
"\xef\xbb\xbf")) {
406 while (location_.offset < sourceSize_) {
407 if (rules_ == maxRules_) {
413 if (!admit(sink_.beginRule(location_)) || !parseSelector() || !expect(
'{')) {
417 while (peek() !=
'}') {
418 if (!parseDeclaration()) {
423 if (!expect(
'}') || !admit(sink_.endRule())) {
434 constexpr char peek()
const {
435 return location_.
offset < sourceSize_ ? sourceData_[location_.
offset] :
'\0';
438 constexpr bool nextIs(
char first,
char second)
const {
439 return location_.
offset < sourceSize_ && sourceSize_ - location_.
offset >= 2 &&
440 sourceData_[location_.
offset] == first && sourceData_[location_.
offset + 1] == second;
443 constexpr std::string_view view(PssSpan span)
const {
444 return source_.substr(span.offset, span.size);
447 constexpr void advance() {
448 pssAdvance(location_, peek());
451 constexpr bool fail(
PssErrorCode code, std::string_view message, std::string_view subject = {}) {
452 error_ = pssError(code, location_, message, subject);
457 constexpr bool failAt(
PssErrorCode code, PssLocation location, std::string_view message,
458 std::string_view subject = {}) {
459 error_ = pssError(code, location, message, subject);
464 constexpr std::expected<void, PssError> failure()
const {
465 return std::unexpected(error_);
468 constexpr bool admit(std::expected<void, PssError> result) {
470 error_ = result.error();
478 constexpr bool skipSpace() {
480 while (pssSpace(peek())) {
484 if (!nextIs(
'/',
'*')) {
491 while (!nextIs(
'*',
'/')) {
492 if (location_.offset == sourceSize_) {
504 constexpr bool expect(
char expected) {
505 if (peek() != expected) {
514 constexpr std::optional<PssSpan> identifier() {
515 if (!pssLetter(peek())) {
521 const auto begin = location_.offset;
524 const auto current = peek();
526 if (!pssLetter(current) && !pssDigit(current) && current !=
'-') {
533 return PssSpan{begin, location_.offset - begin};
536 constexpr bool parseState() {
537 const auto begin = location_;
538 const auto name = identifier();
544 if (view(*name) ==
"read-only") {
549 return admit(sink_.readOnly());
552 for (std::size_t index = 0; index < PSS_STATE_NAMES.size(); ++index) {
553 if (view(*name) == PSS_STATE_NAMES[index]) {
559 return admit(sink_.state(state_));
566 constexpr bool parseSelector() {
576 }
else if (pssLetter(peek())) {
577 const auto begin = location_;
578 const auto name = identifier();
580 if (!admit(sink_.type(*name, begin))) {
588 const auto marker = peek();
590 if (marker !=
'.' && marker !=
'#' && marker !=
':') {
602 if (marker ==
'#' && hasId) {
606 const auto begin = location_;
607 const auto name = identifier();
614 if (!admit(sink_.className(*name, begin))) {
620 if (!admit(sink_.id(*name, begin))) {
634 constexpr std::string_view value() {
635 const auto begin = location_.offset;
638 const auto current = peek();
640 if (current ==
';' || current ==
'}' || current ==
'\0' || pssSpace(current)) {
647 return source_.substr(begin, location_.offset - begin);
650 static constexpr std::optional<RgbColor> parseColor(std::string_view
text) {
651 if (
text.size() != 7 ||
text.front() !=
'#') {
657 for (
const auto value :
text.substr(1)) {
660 if (pssDigit(value)) {
661 part =
static_cast<unsigned>(value -
'0');
662 }
else if (value >=
'a' && value <=
'f') {
663 part =
static_cast<unsigned>(value -
'a' + 10);
664 }
else if (value >=
'A' && value <=
'F') {
665 part =
static_cast<unsigned>(value -
'A' + 10);
670 number = number * 16 + part;
673 return RgbColor{
static_cast<std::uint8_t
>(number >> 16),
static_cast<std::uint8_t
>(number >> 8),
674 static_cast<std::uint8_t
>(number)};
677 static constexpr std::optional<std::int32_t> parseWidth(std::string_view
text) {
678 const bool negative =
text.starts_with(
'-');
681 text.remove_prefix(1);
688 std::int32_t result{};
689 constexpr auto MAX_WIDTH = std::numeric_limits<std::int32_t>::max();
691 for (
const auto value :
text) {
692 if (!pssDigit(value)) {
696 const auto part = value -
'0';
698 if (result > (MAX_WIDTH - part) / 10) {
702 result = result * 10 + part;
705 if (negative && result != 0) {
712 static constexpr std::optional<StyleAxisSize> parseAxis(std::string_view
text) {
713 if (
text ==
"auto") {
714 return StyleAxisSize{};
717 if (
text ==
"fit-content") {
721 if (
text.starts_with(
"flex(") &&
text.ends_with(
')')) {
723 std::uint32_t weight{};
729 for (
const auto digit :
text) {
730 if (!pssDigit(digit) || weight > (std::numeric_limits<std::uint32_t>::max() - (digit -
'0')) / 10) {
734 weight = weight * 10 + (digit -
'0');
737 return weight ? std::optional(StyleAxisSize{
StyleSizeMode::FLEX, 0, weight}) : std::nullopt;
740 if (
const auto extent = parseWidth(
text)) {
747 constexpr bool parseDeclaration() {
748 const auto propertyLocation = location_;
749 const auto name = identifier();
751 if (!name || !skipSpace() || !expect(
':')) {
755 const auto valueLocation = location_;
756 std::string_view
text;
758 if (peek() ==
'\'' || peek() ==
'"') {
759 const auto quote = peek();
761 const auto begin = location_.offset;
762 while (peek() != quote && peek() !=
'\0' && peek() !=
'\n' && peek() !=
'\r') {
765 if (peek() != quote) {
768 text = source_.substr(begin, location_.offset - begin);
773 const auto propertyName = view(*name);
776 while (index < PSS_PROPERTY_NAMES.size() && propertyName != PSS_PROPERTY_NAMES[index]) {
780 std::string_view roleName;
781 if (index == PSS_PROPERTY_NAMES.size() && propertyName.starts_with(PSS_ROLE_PROPERTY_PREFIX)) {
782 constexpr std::array<std::string_view, 5> SUFFIXES{
"-foreground",
"-background",
"-bold",
"-italic",
784 for (std::size_t leaf = 0; leaf < SUFFIXES.size(); ++leaf) {
785 if (propertyName.ends_with(SUFFIXES[leaf]) &&
786 propertyName.size() > PSS_ROLE_PROPERTY_PREFIX.size() + SUFFIXES[leaf].size()) {
787 const auto parsedRole =
788 propertyName.substr(PSS_ROLE_PROPERTY_PREFIX.size(),
789 propertyName.size() - PSS_ROLE_PROPERTY_PREFIX.size() - SUFFIXES[leaf].size());
790 if (detail::validStyleRoleName(parsedRole)) {
791 roleName = parsedRole;
798 if (index == PSS_PROPERTY_NAMES.size()) {
802 const auto property =
static_cast<PssProperty>(index);
803 PssValue declaration;
804 declaration.roleName = roleName;
806 const auto opening = valueLocation.offset < source_.size() ? source_[valueLocation.offset] :
'\0';
807 if (!pssGlyphProperty(property) && (opening ==
'\'' || opening ==
'"')) {
812 if (pssGlyphProperty(property)) {
817 auto utf8 = validatePssUtf8(
text);
819 return failAt(utf8.error().code, valueLocation, utf8.error().message, propertyName);
821 declaration.glyph =
text;
848 const auto color = parseColor(
text);
854 declaration.color = *color;
857 constexpr std::array<std::string_view, 5> TRACK{
"legacy",
"frame",
"minimal",
"ascii",
"fractional-block"};
858 constexpr std::array<std::string_view, 4> THUMB{
"legacy",
"block",
"ascii",
"fractional-block"};
859 constexpr std::array<std::string_view, 3>
ARROW{
"legacy",
"triangle",
"ascii"};
862 : std::span<const std::string_view>(
ARROW);
863 const auto selected = std::ranges::find(names,
text);
865 if (selected == names.end()) {
869 declaration.pattern =
static_cast<std::int32_t
>(selected - names.begin());
871 constexpr std::array<std::string_view, 7> PROFILES{
"default",
"unicode",
"ascii",
"nf-rounded",
872 "nf-chevron",
"nf-slash",
"nf-backslash"};
873 constexpr std::array<std::string_view, 2> FALLBACKS{
"unicode",
"ascii"};
875 : std::span<const std::string_view>(FALLBACKS);
876 const auto selected = std::ranges::find(names,
text);
878 if (selected == names.end()) {
882 declaration.pattern =
static_cast<std::int32_t
>(selected - names.begin());
884 const auto axis = parseAxis(
text);
888 "Expected state-independent cells, auto, fit-content, or flex(positive weight)", propertyName);
891 declaration.pattern =
static_cast<std::int32_t
>(axis->mode);
892 declaration.width = axis->mode ==
StyleSizeMode::FLEX ? std::bit_cast<std::int32_t>(axis->weight) : axis->extent;
895 const auto width = parseWidth(
text);
902 declaration.width = *width;
904 if (
text !=
"true" &&
text !=
"false") {
908 declaration.boolean =
text ==
"true";
911 if (!admit(sink_.declaration(property, declaration, propertyLocation))) {
915 return skipSpace() && expect(
';');
918 std::string_view source_;
919 const char *sourceData_;
920 std::size_t sourceSize_;
923 std::size_t maxBytes_;
924 std::size_t maxRules_;
925 PssLocation location_;
927 std::size_t rules_{};
936constexpr void assignPssDeclaration(
PssProperty property,
PssValue value, StyleDeclarations &destination) {
937 if (pssGlyphProperty(property) || pssRoleProperty(property)) {
943 destination.foreground = value.color;
947 destination.background = value.color;
951 destination.bold = value.boolean;
955 destination.italic = value.boolean;
959 destination.underline = value.boolean;
963 destination.frameLine.foreground = value.color;
967 destination.frameLine.background = value.color;
971 destination.frameLine.bold = value.boolean;
975 destination.frameLine.italic = value.boolean;
979 destination.frameLine.underline = value.boolean;
983 destination.frameTitle.foreground = value.color;
987 destination.frameTitle.background = value.color;
991 destination.frameTitle.bold = value.boolean;
995 destination.frameTitle.italic = value.boolean;
999 destination.frameTitle.underline = value.boolean;
1003 destination.frameEnds.foreground = value.color;
1007 destination.frameEnds.background = value.color;
1011 destination.frameEnds.bold = value.boolean;
1015 destination.frameEnds.italic = value.boolean;
1019 destination.frameEnds.underline = value.boolean;
1023 destination.scrollbarTrack.foreground = value.color;
1027 destination.scrollbarTrack.background = value.color;
1031 destination.scrollbarTrack.bold = value.boolean;
1035 destination.scrollbarTrack.italic = value.boolean;
1039 destination.scrollbarTrack.underline = value.boolean;
1043 destination.scrollbarThumb.foreground = value.color;
1047 destination.scrollbarThumb.background = value.color;
1051 destination.scrollbarThumb.bold = value.boolean;
1055 destination.scrollbarThumb.italic = value.boolean;
1059 destination.scrollbarThumb.underline = value.boolean;
1063 destination.scrollbarThumbStart.foreground = value.color;
1067 destination.scrollbarThumbStart.background = value.color;
1071 destination.scrollbarThumbStart.bold = value.boolean;
1075 destination.scrollbarThumbStart.italic = value.boolean;
1079 destination.scrollbarThumbStart.underline = value.boolean;
1083 destination.scrollbarThumbBody.foreground = value.color;
1087 destination.scrollbarThumbBody.background = value.color;
1091 destination.scrollbarThumbBody.bold = value.boolean;
1095 destination.scrollbarThumbBody.italic = value.boolean;
1099 destination.scrollbarThumbBody.underline = value.boolean;
1103 destination.scrollbarThumbEnd.foreground = value.color;
1107 destination.scrollbarThumbEnd.background = value.color;
1111 destination.scrollbarThumbEnd.bold = value.boolean;
1115 destination.scrollbarThumbEnd.italic = value.boolean;
1119 destination.scrollbarThumbEnd.underline = value.boolean;
1123 destination.scrollbarThumbSingle.foreground = value.color;
1127 destination.scrollbarThumbSingle.background = value.color;
1131 destination.scrollbarThumbSingle.bold = value.boolean;
1135 destination.scrollbarThumbSingle.italic = value.boolean;
1139 destination.scrollbarThumbSingle.underline = value.boolean;
1143 destination.scrollbarEnds.foreground = value.color;
1147 destination.scrollbarEnds.background = value.color;
1151 destination.scrollbarEnds.bold = value.boolean;
1155 destination.scrollbarEnds.italic = value.boolean;
1159 destination.scrollbarEnds.underline = value.boolean;
1163 destination.scrollbarArrows.foreground = value.color;
1167 destination.scrollbarArrows.background = value.color;
1171 destination.scrollbarArrows.bold = value.boolean;
1175 destination.scrollbarArrows.italic = value.boolean;
1179 destination.scrollbarArrows.underline = value.boolean;
1183 destination.scrollbarCorner.foreground = value.color;
1187 destination.scrollbarCorner.background = value.color;
1191 destination.scrollbarCorner.bold = value.boolean;
1195 destination.scrollbarCorner.italic = value.boolean;
1199 destination.scrollbarCorner.underline = value.boolean;
1203 destination.scrollbarTrackPattern =
static_cast<ScrollbarPattern>(value.pattern);
1218 destination.sliderTrack.foreground = value.color;
1222 destination.sliderTrack.background = value.color;
1226 destination.sliderTrack.bold = value.boolean;
1230 destination.sliderTrack.italic = value.boolean;
1234 destination.sliderTrack.underline = value.boolean;
1238 destination.sliderFill.foreground = value.color;
1242 destination.sliderFill.background = value.color;
1246 destination.sliderFill.bold = value.boolean;
1250 destination.sliderFill.italic = value.boolean;
1254 destination.sliderFill.underline = value.boolean;
1258 destination.sliderThumb.foreground = value.color;
1262 destination.sliderThumb.background = value.color;
1266 destination.sliderThumb.bold = value.boolean;
1270 destination.sliderThumb.italic = value.boolean;
1274 destination.sliderThumb.underline = value.boolean;
1278 destination.glyphProfile =
static_cast<GlyphProfile>(value.pattern);
1282 destination.glyphFallback =
static_cast<GlyphFallback>(value.pattern);
1286 destination.minWidth = value.width;
1302inline void assignPssSizing(
PssProperty property,
PssValue value, StyleSizing &destination)
noexcept {
1304 const auto mode =
static_cast<StyleSizeMode>(value.pattern);
1310 destination.maxWidth = value.width;
1312 destination.minHeight = value.width;
1314 destination.maxHeight = value.width;
constexpr PssParser(std::string_view source, Sink &sink, PssPolicy policy, std::size_t maxBytes=MAX_PSS_BYTES, std::size_t maxRules=MAX_STYLE_RULES)
Definition pss_parser.hpp:376
constexpr std::expected< void, PssError > parse()
Definition pss_parser.hpp:383
consteval auto rule(S target, D... declarations)
Definition style_static.hpp:1366
ui::ValueText text(std::format_string< const ui::detail::TextArgumentValue< Args > &... > pattern, Args &&...args)
Declare live formatted text over explicit scalar roots, fields or value properties.
Definition ui_value_text.hpp:567
ScrollbarThumbPattern
Independent thumb source; all choices are opt-in.
Definition scrollbar_skin.hpp:24
PssProperty
PSS v0 declaration identities in metadata and compact descriptions.
Definition pss_data.hpp:13
@ UNDERLINE
Explicit underline flag.
Definition pss_data.hpp:18
@ SCROLLBAR_ARROWS_UNDERLINE
Scrollbar arrows underline.
Definition pss_data.hpp:54
@ SCROLLBAR_TRACK_PATTERN
Independent scrollbar source.
Definition pss_data.hpp:60
@ SCROLLBAR_TRACK_BOLD
Scrollbar track bold.
Definition pss_data.hpp:37
@ FRAME_LINE_FOREGROUND
Frame part frameLine.foreground.
Definition pss_data.hpp:20
@ SCROLLBAR_ARROWS_FOREGROUND
Scrollbar arrows foreground.
Definition pss_data.hpp:50
@ SCROLLBAR_THUMB_SINGLE_UNDERLINE
Thumb single underline.
Definition pss_data.hpp:82
@ SCROLLBAR_THUMB_START_BACKGROUND
Thumb start background.
Definition pss_data.hpp:64
@ ITALIC
Explicit italic flag.
Definition pss_data.hpp:17
@ BOLD
Explicit bold flag.
Definition pss_data.hpp:16
@ FRAME_ENDS_BACKGROUND
Frame part frameEnds.background.
Definition pss_data.hpp:31
@ SCROLLBAR_THUMB_FOREGROUND
Scrollbar thumb foreground.
Definition pss_data.hpp:40
@ SCROLLBAR_THUMB_START_UNDERLINE
Thumb start underline.
Definition pss_data.hpp:67
@ FRAME_ENDS_FOREGROUND
Frame part frameEnds.foreground.
Definition pss_data.hpp:30
@ SCROLLBAR_CORNER_FOREGROUND
Scrollbar corner foreground.
Definition pss_data.hpp:55
@ SCROLLBAR_THUMB_SINGLE_ITALIC
Thumb single italic.
Definition pss_data.hpp:81
@ SLIDER_THUMB_UNDERLINE
Slider thumb underline.
Definition pss_data.hpp:97
@ ROLE_ITALIC
Runtime named semantic role italic.
Definition pss_data.hpp:129
@ SLIDER_TRACK_BOLD
Slider track bold.
Definition pss_data.hpp:85
@ SLIDER_TRACK_ITALIC
Slider track italic.
Definition pss_data.hpp:86
@ FRAME_TITLE_BOLD
Frame part frameTitle.bold.
Definition pss_data.hpp:27
@ FRAME_LINE_BOLD
Frame part frameLine.bold.
Definition pss_data.hpp:22
@ SCROLLBAR_HORIZONTAL_TRACK_GLYPH
Owning runtime literal glyph.
Definition pss_data.hpp:100
@ SLIDER_FILL_UNDERLINE
Slider fill underline.
Definition pss_data.hpp:92
@ WIDTH
Runtime state-independent horizontal mode or exact extent.
Definition pss_data.hpp:121
@ MAX_WIDTH
Runtime state-independent hard column cap.
Definition pss_data.hpp:123
@ MIN_WIDTH
State-independent cell minimum.
Definition pss_data.hpp:19
@ SLIDER_FILL_BACKGROUND
Slider fill background.
Definition pss_data.hpp:89
@ SCROLLBAR_THUMB_BOLD
Scrollbar thumb bold.
Definition pss_data.hpp:42
@ SCROLLBAR_THUMB_BODY_BOLD
Thumb body bold.
Definition pss_data.hpp:70
@ FRAME_TITLE_UNDERLINE
Frame part frameTitle.underline.
Definition pss_data.hpp:29
@ FRAME_ENDS_ITALIC
Frame part frameEnds.italic.
Definition pss_data.hpp:33
@ FRAME_TITLE_BACKGROUND
Frame part frameTitle.background.
Definition pss_data.hpp:26
@ SCROLLBAR_THUMB_PATTERN
Independent scrollbar source.
Definition pss_data.hpp:61
@ GLYPH_FALLBACK
Portable admission fallback.
Definition pss_data.hpp:99
@ SCROLLBAR_THUMB_BODY_UNDERLINE
Thumb body underline.
Definition pss_data.hpp:72
@ SLIDER_FILL_ITALIC
Slider fill italic.
Definition pss_data.hpp:91
@ SCROLLBAR_ENDS_BOLD
Scrollbar ends bold.
Definition pss_data.hpp:47
@ ROLE_BACKGROUND
Runtime named semantic role background.
Definition pss_data.hpp:127
@ SCROLLBAR_THUMB_SINGLE_FOREGROUND
Thumb single foreground.
Definition pss_data.hpp:78
@ SCROLLBAR_THUMB_SINGLE_BOLD
Thumb single bold.
Definition pss_data.hpp:80
@ SCROLLBAR_THUMB_SINGLE_BACKGROUND
Thumb single background.
Definition pss_data.hpp:79
@ GLYPH_PROFILE
Named base glyph map.
Definition pss_data.hpp:98
@ SCROLLBAR_CORNER_ITALIC
Scrollbar corner italic.
Definition pss_data.hpp:58
@ FRAME_LINE_BACKGROUND
Frame part frameLine.background.
Definition pss_data.hpp:21
@ SCROLLBAR_THUMB_END_FOREGROUND
Thumb end foreground.
Definition pss_data.hpp:73
@ SLIDER_TRACK_FOREGROUND
Slider track foreground.
Definition pss_data.hpp:83
@ SCROLLBAR_THUMB_END_BOLD
Thumb end bold.
Definition pss_data.hpp:75
@ SCROLLBAR_THUMB_START_BOLD
Thumb start bold.
Definition pss_data.hpp:65
@ SCROLLBAR_ARROWS_BOLD
Scrollbar arrows bold.
Definition pss_data.hpp:52
@ SLIDER_TRACK_UNDERLINE
Slider track underline.
Definition pss_data.hpp:87
@ SCROLLBAR_TRACK_BACKGROUND
Scrollbar track background.
Definition pss_data.hpp:36
@ FRAME_LINE_ITALIC
Frame part frameLine.italic.
Definition pss_data.hpp:23
@ SCROLLBAR_CORNER_BOLD
Scrollbar corner bold.
Definition pss_data.hpp:57
@ BACKGROUND
RGB fill color.
Definition pss_data.hpp:15
@ ROLE_UNDERLINE
Runtime named semantic role underline.
Definition pss_data.hpp:130
@ SCROLLBAR_THUMB_UNDERLINE
Scrollbar thumb underline.
Definition pss_data.hpp:44
@ SCROLLBAR_THUMB_END_UNDERLINE
Thumb end underline.
Definition pss_data.hpp:77
@ SLIDER_FILL_BOLD
Slider fill bold.
Definition pss_data.hpp:90
@ SCROLLBAR_THUMB_ITALIC
Scrollbar thumb italic.
Definition pss_data.hpp:43
@ SCROLLBAR_THUMB_BODY_ITALIC
Thumb body italic.
Definition pss_data.hpp:71
@ SCROLLBAR_ENDS_FOREGROUND
Scrollbar ends foreground.
Definition pss_data.hpp:45
@ SCROLLBAR_THUMB_END_BACKGROUND
Thumb end background.
Definition pss_data.hpp:74
@ SCROLLBAR_THUMB_START_ITALIC
Thumb start italic.
Definition pss_data.hpp:66
@ FRAME_ENDS_UNDERLINE
Frame part frameEnds.underline.
Definition pss_data.hpp:34
@ SCROLLBAR_ARROWS_ITALIC
Scrollbar arrows italic.
Definition pss_data.hpp:53
@ SLIDER_FILL_FOREGROUND
Slider fill foreground.
Definition pss_data.hpp:88
@ SLIDER_TRACK_BACKGROUND
Slider track background.
Definition pss_data.hpp:84
@ SLIDER_THUMB_BOLD
Slider thumb bold.
Definition pss_data.hpp:95
@ ROLE_BOLD
Runtime named semantic role bold.
Definition pss_data.hpp:128
@ SCROLLBAR_ARROWS_BACKGROUND
Scrollbar arrows background.
Definition pss_data.hpp:51
@ SCROLLBAR_THUMB_BODY_BACKGROUND
Thumb body background.
Definition pss_data.hpp:69
@ SCROLLBAR_THUMB_START_FOREGROUND
Thumb start foreground.
Definition pss_data.hpp:63
@ SCROLLBAR_ARROW_PATTERN
Independent scrollbar source.
Definition pss_data.hpp:62
@ SLIDER_THUMB_FOREGROUND
Slider thumb foreground.
Definition pss_data.hpp:93
@ SCROLLBAR_TRACK_UNDERLINE
Scrollbar track underline.
Definition pss_data.hpp:39
@ SCROLLBAR_TRACK_FOREGROUND
Scrollbar track foreground.
Definition pss_data.hpp:35
@ SCROLLBAR_THUMB_BACKGROUND
Scrollbar thumb background.
Definition pss_data.hpp:41
@ SCROLLBAR_ENDS_ITALIC
Scrollbar ends italic.
Definition pss_data.hpp:48
@ SCROLLBAR_THUMB_BODY_FOREGROUND
Thumb body foreground.
Definition pss_data.hpp:68
@ SCROLLBAR_CORNER_UNDERLINE
Scrollbar corner underline.
Definition pss_data.hpp:59
@ FRAME_TITLE_FOREGROUND
Frame part frameTitle.foreground.
Definition pss_data.hpp:25
@ HEIGHT
Runtime state-independent vertical mode or exact extent.
Definition pss_data.hpp:122
@ FRAME_ENDS_BOLD
Frame part frameEnds.bold.
Definition pss_data.hpp:32
@ SCROLLBAR_CORNER_GLYPH
Owning runtime literal glyph.
Definition pss_data.hpp:120
@ SCROLLBAR_THUMB_END_ITALIC
Thumb end italic.
Definition pss_data.hpp:76
@ SCROLLBAR_ENDS_UNDERLINE
Scrollbar ends underline.
Definition pss_data.hpp:49
@ FOREGROUND
RGB text color.
Definition pss_data.hpp:14
@ SLIDER_THUMB_ITALIC
Slider thumb italic.
Definition pss_data.hpp:96
@ ROLE_FOREGROUND
Runtime named semantic role foreground; name is occurrence metadata.
Definition pss_data.hpp:126
@ SLIDER_THUMB_BACKGROUND
Slider thumb background.
Definition pss_data.hpp:94
@ MAX_HEIGHT
Runtime state-independent hard row cap.
Definition pss_data.hpp:125
@ SCROLLBAR_TRACK_ITALIC
Scrollbar track italic.
Definition pss_data.hpp:38
@ SCROLLBAR_ENDS_BACKGROUND
Scrollbar ends background.
Definition pss_data.hpp:46
@ FRAME_LINE_UNDERLINE
Frame part frameLine.underline.
Definition pss_data.hpp:24
@ SCROLLBAR_CORNER_BACKGROUND
Scrollbar corner background.
Definition pss_data.hpp:56
@ FRAME_TITLE_ITALIC
Frame part frameTitle.italic.
Definition pss_data.hpp:28
@ MIN_HEIGHT
Runtime state-independent hard row minimum.
Definition pss_data.hpp:124
StyleSizeMode
State-independent style request for one allocation axis.
Definition style_types.hpp:139
@ CONTENT
Prefer intrinsic content without consuming spare cells.
Definition style_types.hpp:143
@ FIXED
Intersect an exact cell extent with all hard bounds.
Definition style_types.hpp:141
@ FLEX
Share spare cells using the positive weight.
Definition style_types.hpp:142
ScrollbarPattern
Opt-in scrollbar glyph presets; legacy calls retain their original appearance.
Definition scrollbar_skin.hpp:15
@ ARROW
Arrow directions.
Definition spinner.hpp:25
GlyphProfile
Explicit glyph map, independent of colors and geometry. NF maps use Nerd Fonts 3 Powerline codepoints...
Definition glyph_profile.hpp:12
GlyphFallback
Portable replacement when the selected map fails one-cell admission.
Definition glyph_profile.hpp:23
StyleState
Presentation states; ANY matches every state without changing behavior.
Definition style.hpp:26
@ ANY
Match all presentation variants.
Definition style.hpp:27
constexpr std::size_t DEFAULT_SCROLLBAR_GLYPH_BYTES
Default UTF-8 byte cap for each supplied scrollbar glyph.
Definition scrollbar_skin.hpp:13
constexpr std::size_t MAX_STYLE_RULES
Finite typed/PSS rule budget.
Definition style.hpp:302
constexpr std::size_t MAX_PSS_BYTES
Finite parser input byte budget.
Definition style.hpp:304
ScrollbarArrowPattern
Independent functional-arrow source; selecting it never enables buttons.
Definition scrollbar_skin.hpp:32
PssErrorCode
Structured PSS errors independent of compiler wording.
Definition pss_data.hpp:153
@ RULE_LIMIT
Source-order rule count exceeds the selected budget.
Definition pss_data.hpp:156
@ INPUT_LIMIT
Input bytes exceed the selected budget.
Definition pss_data.hpp:155
@ UNTERMINATED_COMMENT
Missing comment terminator.
Definition pss_data.hpp:167
@ INVALID_WIDTH
Negative, overflowing, or state-dependent minimum width.
Definition pss_data.hpp:173
@ UNKNOWN_PROPERTY
Unsupported v0 declaration name.
Definition pss_data.hpp:171
@ EXPECTED_PUNCTUATION
Missing required punctuation.
Definition pss_data.hpp:166
@ EXPECTED_IDENTIFIER
Expected an ASCII name.
Definition pss_data.hpp:165
@ DUPLICATE_STATE
More than one presentation-state predicate.
Definition pss_data.hpp:169
@ DUPLICATE_ID
More than one ID predicate in a selector.
Definition pss_data.hpp:168
@ EXPECTED_SELECTOR
No v0 selector at the current position.
Definition pss_data.hpp:164
@ NUL_BYTE
Embedded NUL in strict input or source identity.
Definition pss_data.hpp:163
@ INVALID_UTF8
Invalid UTF-8 sequence anywhere in strict input.
Definition pss_data.hpp:162
@ INVALID_VALUE
Value does not have the property's exact scalar syntax.
Definition pss_data.hpp:172
@ UNKNOWN_STATE
Unsupported presentation state.
Definition pss_data.hpp:170
std::size_t offset
Zero-based byte offset.
Definition pss_data.hpp:179
Allocation-free declaration scalar; its owning occurrence property identifies the active field.
Definition pss_data.hpp:190
std::string name
Lower-kebab name, copied by owning declarations.
Definition style.hpp:115
Borrowed byte range used only within a synchronous parser invocation.
Definition pss_parser.hpp:16
std::size_t offset
Start in the original source.
Definition pss_parser.hpp:17
std::size_t size
Number of bytes.
Definition pss_parser.hpp:18
Small validated scalar payload; avoids constructing six optional fields per parsed occurrence.
Definition pss_parser.hpp:22
constexpr PssValue(PssScalarValue scalar={})
Definition pss_parser.hpp:24
std::string_view glyph
Synchronous parser borrow; runtime sinks must copy before returning.
Definition pss_parser.hpp:28
std::string_view roleName
Synchronous named destination; runtime sinks must copy.
Definition pss_parser.hpp:27