xbintsc 0.3.18 → 0.3.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/README.md +33 -0
  2. package/dist/src/cli/main.js +124 -30
  3. package/dist/src/cli/main.js.map +1 -1
  4. package/dist/src/codegen/generator/calls/access.js +8 -1
  5. package/dist/src/codegen/generator/calls/access.js.map +1 -1
  6. package/dist/src/codegen/generator/state.js +20 -0
  7. package/dist/src/codegen/generator/state.js.map +1 -1
  8. package/dist/src/codegen/generator/tables.d.ts +6 -0
  9. package/dist/src/codegen/generator/tables.js +38 -0
  10. package/dist/src/codegen/generator/tables.js.map +1 -1
  11. package/dist/src/driver/bundler/commonjs.d.ts +52 -0
  12. package/dist/src/driver/bundler/commonjs.js +493 -0
  13. package/dist/src/driver/bundler/commonjs.js.map +1 -0
  14. package/dist/src/driver/bundler/graph.d.ts +2 -1
  15. package/dist/src/driver/bundler/graph.js +32 -3
  16. package/dist/src/driver/bundler/graph.js.map +1 -1
  17. package/dist/src/driver/bundler/merge.d.ts +2 -1
  18. package/dist/src/driver/bundler/merge.js +16 -2
  19. package/dist/src/driver/bundler/merge.js.map +1 -1
  20. package/dist/src/driver/bundler/types.d.ts +8 -0
  21. package/dist/src/driver/compiler.d.ts +8 -1
  22. package/dist/src/driver/compiler.js +75 -7
  23. package/dist/src/driver/compiler.js.map +1 -1
  24. package/dist/src/driver/config.d.ts +53 -0
  25. package/dist/src/driver/config.js +141 -0
  26. package/dist/src/driver/config.js.map +1 -0
  27. package/dist/src/driver/icon.d.ts +62 -0
  28. package/dist/src/driver/icon.js +151 -0
  29. package/dist/src/driver/icon.js.map +1 -0
  30. package/dist/src/driver/index.d.ts +4 -0
  31. package/dist/src/driver/index.js +4 -0
  32. package/dist/src/driver/index.js.map +1 -1
  33. package/dist/src/driver/mac-bundle.d.ts +41 -0
  34. package/dist/src/driver/mac-bundle.js +123 -0
  35. package/dist/src/driver/mac-bundle.js.map +1 -0
  36. package/dist/src/driver/win-icon.d.ts +27 -0
  37. package/dist/src/driver/win-icon.js +80 -0
  38. package/dist/src/driver/win-icon.js.map +1 -0
  39. package/dist/src/extensions/gui/html.d.ts +25 -0
  40. package/dist/src/extensions/gui/html.js +203 -0
  41. package/dist/src/extensions/gui/html.js.map +1 -0
  42. package/dist/src/extensions/gui/index.js +11 -0
  43. package/dist/src/extensions/gui/index.js.map +1 -1
  44. package/dist/src/extensions/registry.d.ts +29 -0
  45. package/dist/src/extensions/registry.js +14 -0
  46. package/dist/src/extensions/registry.js.map +1 -1
  47. package/dist/src/index.d.ts +1 -1
  48. package/dist/src/index.js.map +1 -1
  49. package/dist/src/lexer/scanner/identifiers.js +4 -12
  50. package/dist/src/lexer/scanner/identifiers.js.map +1 -1
  51. package/dist/src/parser/statements.js +17 -4
  52. package/dist/src/parser/statements.js.map +1 -1
  53. package/dist/tests/cli/main.test.js +46 -1
  54. package/dist/tests/cli/main.test.js.map +1 -1
  55. package/dist/tests/driver/bundler-resolve.test.d.ts +1 -0
  56. package/dist/tests/driver/bundler-resolve.test.js +230 -0
  57. package/dist/tests/driver/bundler-resolve.test.js.map +1 -0
  58. package/dist/tests/driver/config.test.d.ts +1 -0
  59. package/dist/tests/driver/config.test.js +124 -0
  60. package/dist/tests/driver/config.test.js.map +1 -0
  61. package/dist/tests/driver/icon.test.d.ts +1 -0
  62. package/dist/tests/driver/icon.test.js +421 -0
  63. package/dist/tests/driver/icon.test.js.map +1 -0
  64. package/dist/tests/driver/modules.test.js +177 -0
  65. package/dist/tests/driver/modules.test.js.map +1 -1
  66. package/dist/tests/e2e/fetch.test.d.ts +12 -0
  67. package/dist/tests/e2e/fetch.test.js +272 -0
  68. package/dist/tests/e2e/fetch.test.js.map +1 -0
  69. package/dist/tests/e2e/gui-dom.test.d.ts +5 -0
  70. package/dist/tests/e2e/gui-dom.test.js +102 -0
  71. package/dist/tests/e2e/gui-dom.test.js.map +1 -0
  72. package/dist/tests/e2e/gui-events.test.d.ts +5 -0
  73. package/dist/tests/e2e/gui-events.test.js +60 -0
  74. package/dist/tests/e2e/gui-events.test.js.map +1 -0
  75. package/dist/tests/e2e/gui-helpers.d.ts +31 -0
  76. package/dist/tests/e2e/gui-helpers.js +74 -0
  77. package/dist/tests/e2e/gui-helpers.js.map +1 -0
  78. package/dist/tests/e2e/gui-layout.test.d.ts +4 -0
  79. package/dist/tests/e2e/gui-layout.test.js +88 -0
  80. package/dist/tests/e2e/gui-layout.test.js.map +1 -0
  81. package/dist/tests/e2e/gui-lifecycle.test.d.ts +5 -0
  82. package/dist/tests/e2e/gui-lifecycle.test.js +58 -0
  83. package/dist/tests/e2e/gui-lifecycle.test.js.map +1 -0
  84. package/dist/tests/e2e/gui-paint.test.d.ts +5 -0
  85. package/dist/tests/e2e/gui-paint.test.js +111 -0
  86. package/dist/tests/e2e/gui-paint.test.js.map +1 -0
  87. package/dist/tests/e2e/gui-script.test.d.ts +5 -0
  88. package/dist/tests/e2e/gui-script.test.js +78 -0
  89. package/dist/tests/e2e/gui-script.test.js.map +1 -0
  90. package/dist/tests/e2e/gui-style.test.d.ts +5 -0
  91. package/dist/tests/e2e/gui-style.test.js +175 -0
  92. package/dist/tests/e2e/gui-style.test.js.map +1 -0
  93. package/dist/tests/e2e/icon.test.d.ts +7 -0
  94. package/dist/tests/e2e/icon.test.js +80 -0
  95. package/dist/tests/e2e/icon.test.js.map +1 -0
  96. package/dist/tests/e2e/npm-modules.test.d.ts +4 -1
  97. package/dist/tests/e2e/npm-modules.test.js +47 -1
  98. package/dist/tests/e2e/npm-modules.test.js.map +1 -1
  99. package/dist/tests/e2e/runtime-coverage-typed-array.test.d.ts +9 -0
  100. package/dist/tests/e2e/runtime-coverage-typed-array.test.js +140 -0
  101. package/dist/tests/e2e/runtime-coverage-typed-array.test.js.map +1 -0
  102. package/dist/tests/extensions/gui-index.test.d.ts +1 -0
  103. package/dist/tests/extensions/gui-index.test.js +49 -0
  104. package/dist/tests/extensions/gui-index.test.js.map +1 -0
  105. package/dist/tests/extensions/gui.test.d.ts +1 -0
  106. package/dist/tests/extensions/gui.test.js +177 -0
  107. package/dist/tests/extensions/gui.test.js.map +1 -0
  108. package/dist/tests/extensions/registry.test.js +36 -0
  109. package/dist/tests/extensions/registry.test.js.map +1 -1
  110. package/dist/tests/parser/statements.test.js +11 -0
  111. package/dist/tests/parser/statements.test.js.map +1 -1
  112. package/dist/tests/public-api.test.d.ts +1 -0
  113. package/dist/tests/public-api.test.js +31 -0
  114. package/dist/tests/public-api.test.js.map +1 -0
  115. package/package.json +1 -1
  116. package/runtime/ext_gui/css.cpp +4 -517
  117. package/runtime/ext_gui/css_internal.h +27 -0
  118. package/runtime/ext_gui/css_match.cpp +195 -0
  119. package/runtime/ext_gui/css_selector.cpp +207 -0
  120. package/runtime/ext_gui/css_sheet.cpp +129 -0
  121. package/runtime/ext_gui/document.cpp +90 -0
  122. package/runtime/ext_gui/document.h +23 -0
  123. package/runtime/ext_gui/dom.cpp +43 -403
  124. package/runtime/ext_gui/dom.h +7 -0
  125. package/runtime/ext_gui/dom_api.cpp +164 -0
  126. package/runtime/ext_gui/dom_api.h +12 -0
  127. package/runtime/ext_gui/dom_api_document.cpp +96 -0
  128. package/runtime/ext_gui/dom_api_events.cpp +123 -0
  129. package/runtime/ext_gui/dom_api_internal.h +135 -0
  130. package/runtime/ext_gui/dom_api_node.cpp +329 -0
  131. package/runtime/ext_gui/dom_api_node_read.cpp +294 -0
  132. package/runtime/ext_gui/dom_api_proto.cpp +130 -0
  133. package/runtime/ext_gui/dom_api_style.cpp +192 -0
  134. package/runtime/ext_gui/dom_internal.h +39 -0
  135. package/runtime/ext_gui/dom_parse.cpp +348 -0
  136. package/runtime/ext_gui/dom_serialize.cpp +54 -0
  137. package/runtime/ext_gui/gui.cpp +61 -245
  138. package/runtime/ext_gui/gui_engine.h +54 -0
  139. package/runtime/ext_gui/gui_events.cpp +294 -0
  140. package/runtime/ext_gui/gui_internal.h +29 -0
  141. package/runtime/ext_gui/layout.cpp +6 -597
  142. package/runtime/ext_gui/layout_flex.cpp +200 -0
  143. package/runtime/ext_gui/layout_flow.cpp +191 -0
  144. package/runtime/ext_gui/layout_flow_internal.h +149 -0
  145. package/runtime/ext_gui/layout_inline.cpp +181 -0
  146. package/runtime/ext_gui/layout_internal.h +20 -0
  147. package/runtime/ext_gui/renderer.cpp +15 -679
  148. package/runtime/ext_gui/renderer_image.cpp +233 -0
  149. package/runtime/ext_gui/renderer_internal.h +112 -0
  150. package/runtime/ext_gui/renderer_shaders.h +108 -0
  151. package/runtime/ext_gui/renderer_text.cpp +342 -0
  152. package/runtime/ext_gui/script.cpp +63 -0
  153. package/runtime/ext_gui/style.cpp +12 -660
  154. package/runtime/ext_gui/style_internal.h +33 -0
  155. package/runtime/ext_gui/style_print.cpp +113 -0
  156. package/runtime/ext_gui/style_ua.cpp +98 -0
  157. package/runtime/ext_gui/style_values.cpp +468 -0
  158. package/runtime/ext_gui/window.cpp +60 -0
  159. package/runtime/rt.h +6 -0
  160. package/runtime/rt_internal.h +4 -0
  161. package/runtime/xt_builtins.c +1 -0
  162. package/runtime/xt_containers/access.inc +32 -1
  163. package/runtime/xt_fetch/buffer.inc +64 -0
  164. package/runtime/xt_fetch/headers.inc +312 -0
  165. package/runtime/xt_fetch/request.inc +386 -0
  166. package/runtime/xt_fetch/response.inc +107 -0
  167. package/runtime/xt_fetch/socket.inc +72 -0
  168. package/runtime/xt_fetch/url.inc +108 -0
  169. package/runtime/xt_fetch.c +39 -0
  170. package/runtime/xt_stdlib2/set.inc +1 -1
  171. package/runtime/xt_typed_array.c +614 -0
  172. package/src/cli/main.ts +137 -29
  173. package/src/codegen/generator/calls/access.ts +9 -1
  174. package/src/codegen/generator/state.ts +20 -0
  175. package/src/codegen/generator/tables.ts +40 -0
  176. package/src/driver/bundler/commonjs.ts +553 -0
  177. package/src/driver/bundler/graph.ts +35 -2
  178. package/src/driver/bundler/merge.ts +18 -1
  179. package/src/driver/bundler/types.ts +8 -0
  180. package/src/driver/compiler.ts +85 -7
  181. package/src/driver/config.ts +173 -0
  182. package/src/driver/icon.ts +184 -0
  183. package/src/driver/index.ts +30 -0
  184. package/src/driver/mac-bundle.ts +156 -0
  185. package/src/driver/win-icon.ts +96 -0
  186. package/src/extensions/gui/html.ts +236 -0
  187. package/src/extensions/gui/index.ts +11 -0
  188. package/src/extensions/registry.ts +39 -0
  189. package/src/index.ts +1 -1
  190. package/src/lexer/scanner/identifiers.ts +4 -11
  191. package/src/parser/statements.ts +17 -4
  192. package/dist/tests/e2e/gui.test.d.ts +0 -12
  193. package/dist/tests/e2e/gui.test.js +0 -493
  194. package/dist/tests/e2e/gui.test.js.map +0 -1
@@ -0,0 +1,33 @@
1
+ /*
2
+ * xbintsc GUI engine — shared declarations for the style translation units
3
+ * (`style.cpp`, `style_values.cpp`, `style_ua.cpp`, `style_print.cpp`).
4
+ */
5
+ #ifndef XT_GUI_STYLE_INTERNAL_H
6
+ #define XT_GUI_STYLE_INTERNAL_H
7
+
8
+ #include "style.h"
9
+
10
+ namespace xtgui {
11
+
12
+ /** Per-node cascade inputs threaded through declaration application. */
13
+ struct ApplyContext {
14
+ float rootFontSize = 16.0f;
15
+ float parentFontSize = 16.0f;
16
+ float viewportWidth = 0.0f;
17
+ float viewportHeight = 0.0f;
18
+ };
19
+
20
+ /** Resolve a length to pixels given the current font/viewport context. */
21
+ float xt_style_resolve_absolute(const Length &length, float base, float em, float root, float vw,
22
+ float vh);
23
+
24
+ /** Apply the built-in user-agent rules for one element. */
25
+ void xt_style_apply_user_agent(const Node *node, XtStyle *style);
26
+
27
+ /** Apply one parsed declaration (`property: value`) onto a computed style. */
28
+ void xt_style_apply_declaration(XtStyle *style, const std::string &property,
29
+ const std::string &rawValue, const ApplyContext &context);
30
+
31
+ } // namespace xtgui
32
+
33
+ #endif /* XT_GUI_STYLE_INTERNAL_H */
@@ -0,0 +1,113 @@
1
+ /*
2
+ * xbintsc GUI engine — computed-style diagnostics (`getComputedStyle`).
3
+ */
4
+
5
+ #include "style_internal.h"
6
+
7
+ #include <cstdio>
8
+
9
+ namespace xtgui {
10
+
11
+ static std::string formatNumber(float number) {
12
+ char buffer[64];
13
+ if (number == (float)(long)number) {
14
+ snprintf(buffer, sizeof(buffer), "%ld", (long)number);
15
+ } else {
16
+ snprintf(buffer, sizeof(buffer), "%.4g", number);
17
+ }
18
+ return buffer;
19
+ }
20
+
21
+ static std::string formatLength(const Length &length) {
22
+ switch (length.unit) {
23
+ case Unit::Auto:
24
+ return "auto";
25
+ case Unit::None:
26
+ return "none";
27
+ case Unit::Number:
28
+ return formatNumber(length.value);
29
+ case Unit::Px:
30
+ return formatNumber(length.value) + "px";
31
+ case Unit::Percent:
32
+ return formatNumber(length.value) + "%";
33
+ case Unit::Em:
34
+ return formatNumber(length.value) + "em";
35
+ case Unit::Rem:
36
+ return formatNumber(length.value) + "rem";
37
+ case Unit::Vw:
38
+ return formatNumber(length.value) + "vw";
39
+ case Unit::Vh:
40
+ return formatNumber(length.value) + "vh";
41
+ default:
42
+ return "";
43
+ }
44
+ }
45
+
46
+ static std::string formatColor(const Color &color) {
47
+ if (color.a >= 1.0f) {
48
+ char buffer[64];
49
+ snprintf(buffer, sizeof(buffer), "rgb(%ld, %ld, %ld)", (long)(color.r * 255.0f + 0.5f),
50
+ (long)(color.g * 255.0f + 0.5f), (long)(color.b * 255.0f + 0.5f));
51
+ return buffer;
52
+ }
53
+ char buffer[96];
54
+ snprintf(buffer, sizeof(buffer), "rgba(%ld, %ld, %ld, %.2f)", (long)(color.r * 255.0f + 0.5f),
55
+ (long)(color.g * 255.0f + 0.5f), (long)(color.b * 255.0f + 0.5f), color.a);
56
+ return buffer;
57
+ }
58
+
59
+ std::string xt_style_property_to_string(const XtStyle &style, const std::string &rawProperty) {
60
+ std::string property = xt_css_lower(xt_css_trim(rawProperty));
61
+ static const char *const displayNames[] = {"none", "block", "inline", "inline-block", "flex", "list-item"};
62
+ static const char *const positionNames[] = {"static", "relative", "absolute", "fixed"};
63
+ static const char *const flexNames[] = {"row", "row-reverse", "column", "column-reverse"};
64
+ static const char *const justifyNames[] = {"flex-start", "flex-end", "center", "space-between",
65
+ "space-around", "space-evenly"};
66
+ static const char *const alignNames[] = {"stretch", "flex-start", "flex-end", "center", "baseline"};
67
+ static const char *const alignTextNames[] = {"start", "center", "end", "justify"};
68
+
69
+ if (property == "display") return displayNames[(int)style.display];
70
+ if (property == "position") return positionNames[(int)style.position];
71
+ if (property == "color") return formatColor(style.color);
72
+ if (property == "background-color" || property == "background") {
73
+ return style.has_background ? formatColor(style.background) : "rgba(0, 0, 0, 0)";
74
+ }
75
+ if (property == "width") return formatLength(style.width);
76
+ if (property == "height") return formatLength(style.height);
77
+ if (property == "min-width") return formatLength(style.min_width);
78
+ if (property == "min-height") return formatLength(style.min_height);
79
+ if (property == "max-width") return formatLength(style.max_width);
80
+ if (property == "max-height") return formatLength(style.max_height);
81
+ if (property == "top") return formatLength(style.top);
82
+ if (property == "right") return formatLength(style.right);
83
+ if (property == "bottom") return formatLength(style.bottom);
84
+ if (property == "left") return formatLength(style.left);
85
+ if (property == "margin-top") return formatLength(style.margin.top);
86
+ if (property == "margin-right") return formatLength(style.margin.right);
87
+ if (property == "margin-bottom") return formatLength(style.margin.bottom);
88
+ if (property == "margin-left") return formatLength(style.margin.left);
89
+ if (property == "padding-top") return formatLength(style.padding.top);
90
+ if (property == "padding-right") return formatLength(style.padding.right);
91
+ if (property == "padding-bottom") return formatLength(style.padding.bottom);
92
+ if (property == "padding-left") return formatLength(style.padding.left);
93
+ if (property == "font-size") return formatNumber(style.font_size) + "px";
94
+ if (property == "font-weight") return formatNumber((float)style.font_weight);
95
+ if (property == "font-family") return style.font_family;
96
+ if (property == "line-height") {
97
+ return style.line_height.unit == Unit::Auto ? "normal" : formatLength(style.line_height);
98
+ }
99
+ if (property == "text-align") return alignTextNames[(int)style.text_align];
100
+ if (property == "flex-direction") return flexNames[(int)style.flex_direction];
101
+ if (property == "justify-content") return justifyNames[(int)style.justify_content];
102
+ if (property == "align-items") return alignNames[(int)style.align_items];
103
+ if (property == "gap") return formatLength(style.gap);
104
+ if (property == "flex-grow") return formatNumber(style.flex_grow);
105
+ if (property == "flex-shrink") return formatNumber(style.flex_shrink);
106
+ if (property == "flex-basis") return formatLength(style.flex_basis);
107
+ if (property == "border-radius") return formatNumber(style.border_radius) + "px";
108
+ if (property == "opacity") return formatNumber(style.opacity);
109
+ if (property == "z-index") return style.has_z_index ? formatNumber((float)style.z_index) : "auto";
110
+ return "";
111
+ }
112
+
113
+ } // namespace xtgui
@@ -0,0 +1,98 @@
1
+ /*
2
+ * xbintsc GUI engine — built-in user-agent stylesheet.
3
+ */
4
+
5
+ #include "style_internal.h"
6
+
7
+ #include <unordered_map>
8
+
9
+ namespace xtgui {
10
+
11
+ namespace {
12
+
13
+ bool isBlockTag(const std::string &tag) {
14
+ static const std::unordered_map<std::string, bool> tags = {
15
+ {"address", true}, {"article", true}, {"aside", true}, {"blockquote", true},
16
+ {"dd", true}, {"div", true}, {"dl", true}, {"dt", true},
17
+ {"fieldset", true}, {"figcaption", true}, {"figure", true}, {"footer", true},
18
+ {"form", true}, {"h1", true}, {"h2", true}, {"h3", true},
19
+ {"h4", true}, {"h5", true}, {"h6", true}, {"header", true},
20
+ {"hr", true}, {"li", true}, {"main", true}, {"nav", true},
21
+ {"ol", true}, {"p", true}, {"pre", true}, {"section", true},
22
+ {"table", true}, {"tbody", true}, {"td", true}, {"tfoot", true},
23
+ {"th", true}, {"thead", true}, {"tr", true}, {"ul", true},
24
+ };
25
+ return tags.count(tag) != 0;
26
+ }
27
+
28
+ } // namespace
29
+
30
+ void xt_style_apply_user_agent(const Node *node, XtStyle *style) {
31
+ const std::string &tag = node->tag;
32
+ if (tag == "html" || tag == "body") style->display = Display::Block;
33
+ if (isBlockTag(tag)) style->display = Display::Block;
34
+ if (tag == "head" || tag == "style" || tag == "script" || tag == "title" || tag == "meta" ||
35
+ tag == "link" || tag == "base" || tag == "template") {
36
+ style->display = Display::None;
37
+ }
38
+ if (tag == "br") style->display = Display::Block;
39
+ if (tag == "button" || tag == "input" || tag == "select" || tag == "textarea") {
40
+ style->display = Display::InlineBlock;
41
+ }
42
+ if (tag == "img") style->display = Display::InlineBlock;
43
+ if (tag == "body") style->margin.set({8.0f, Unit::Px});
44
+ if (tag == "p") style->margin.top = style->margin.bottom = {16.0f, Unit::Px};
45
+ if (tag == "blockquote") {
46
+ style->margin.top = style->margin.bottom = {16.0f, Unit::Px};
47
+ style->margin.left = style->margin.right = {40.0f, Unit::Px};
48
+ }
49
+ if (tag == "h1") {
50
+ style->font_size = 32.0f;
51
+ style->font_weight = 700;
52
+ style->margin.top = style->margin.bottom = {21.44f, Unit::Px};
53
+ } else if (tag == "h2") {
54
+ style->font_size = 24.0f;
55
+ style->font_weight = 700;
56
+ style->margin.top = style->margin.bottom = {19.92f, Unit::Px};
57
+ } else if (tag == "h3") {
58
+ style->font_size = 18.72f;
59
+ style->font_weight = 700;
60
+ style->margin.top = style->margin.bottom = {18.72f, Unit::Px};
61
+ } else if (tag == "h4") {
62
+ style->font_size = 16.0f;
63
+ style->font_weight = 700;
64
+ style->margin.top = style->margin.bottom = {21.28f, Unit::Px};
65
+ } else if (tag == "h5") {
66
+ style->font_size = 13.28f;
67
+ style->font_weight = 700;
68
+ style->margin.top = style->margin.bottom = {22.18f, Unit::Px};
69
+ } else if (tag == "h6") {
70
+ style->font_size = 10.72f;
71
+ style->font_weight = 700;
72
+ style->margin.top = style->margin.bottom = {24.97f, Unit::Px};
73
+ }
74
+ if (tag == "strong" || tag == "b") style->font_weight = 700;
75
+ if (tag == "dt") style->font_weight = 700;
76
+ if (tag == "em" || tag == "i") style->font_style = FontStyle::Italic;
77
+ if (tag == "small") style->font_size = 13.333f;
78
+ if (tag == "a") {
79
+ style->color = {0.0f, 0.0f, 0.933f, 1.0f};
80
+ }
81
+ if (tag == "ul" || tag == "ol") {
82
+ style->padding.left = {40.0f, Unit::Px};
83
+ style->margin.top = style->margin.bottom = {16.0f, Unit::Px};
84
+ }
85
+ if (tag == "pre" || tag == "code" || tag == "kbd" || tag == "samp") {
86
+ style->font_family = "monospace";
87
+ }
88
+ if (tag == "pre") style->white_space = WhiteSpace::Pre;
89
+ if (tag == "hr") {
90
+ style->border_width.top = {1.0f, Unit::Px};
91
+ style->border_style = BorderStyle::Solid;
92
+ style->border_color = {0.5f, 0.5f, 0.5f, 1.0f};
93
+ style->has_border_color = true;
94
+ style->margin.top = style->margin.bottom = {8.0f, Unit::Px};
95
+ }
96
+ }
97
+
98
+ } // namespace xtgui