@geastack/engine 0.1.5 → 0.1.7

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 (45) hide show
  1. package/README.md +70 -0
  2. package/canvas.cpp +86 -30
  3. package/css/animation.h +64 -0
  4. package/css/declarative.h +6 -0
  5. package/css/engine.h +25 -1
  6. package/image_store.cpp +136 -33
  7. package/package.json +2 -2
  8. package/ui/CSS_FEATURES.md +261 -0
  9. package/ui/absolute_leaf_refresh.cpp +42 -39
  10. package/ui/core.cpp +32 -1
  11. package/ui/css_atom.cpp +6 -0
  12. package/ui/css_atom.h +2 -0
  13. package/ui/css_features.h +282 -0
  14. package/ui/display_invalidation.cpp +29 -0
  15. package/ui/flex_balance.h +73 -0
  16. package/ui/image_node.cpp +33 -28
  17. package/ui/input.cpp +88 -38
  18. package/ui/input_render.cpp +17 -13
  19. package/ui/internal.h +51 -5
  20. package/ui/layout.cpp +2601 -441
  21. package/ui/layout_snapshot.cpp +49 -6
  22. package/ui/node_features.h +18 -0
  23. package/ui/node_lifecycle.cpp +204 -71
  24. package/ui/node_lifecycle.h +1 -0
  25. package/ui/node_model.h +930 -70
  26. package/ui/node_text.h +82 -0
  27. package/ui/render.cpp +793 -352
  28. package/ui/renderer_features.h +19 -0
  29. package/ui/root_scroll_refresh.cpp +46 -24
  30. package/ui/style.cpp +4155 -1073
  31. package/ui/style.h +143 -6
  32. package/ui/style_values.h +16 -0
  33. package/ui/text.cpp +401 -106
  34. package/ui/tree_events.cpp +138 -95
  35. package/ui/tree_events.h +28 -19
  36. package/ui/tree_inspection.h +15 -0
  37. package/ui/tree_internal.h +19 -0
  38. package/ui/tree_nodes.cpp +38 -4
  39. package/ui/tree_render.cpp +119 -40
  40. package/ui/tree_scroll_mirror.cpp +26 -0
  41. package/ui/tree_state.cpp +261 -114
  42. package/ui/tree_state.h +121 -16
  43. package/ui/tree_style.cpp +609 -82
  44. package/ui/view.cpp +720 -299
  45. package/ui/virtual_keyboard.cpp +10 -3
package/ui/node_text.h ADDED
@@ -0,0 +1,82 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ #pragma once
3
+ #include <cstdint>
4
+ #include <string>
5
+
6
+ namespace gea::embedded::ui
7
+ {
8
+ // Empty nodes own no string storage. Nonempty text lives in stable pooled
9
+ // records, preserving c_str() addresses while other nodes are created/removed.
10
+ // Copies own independent records: retained display commands can scrub one
11
+ // node's old buffer without invalidating a clone's unchanged text.
12
+ class NodeText
13
+ {
14
+ public:
15
+ NodeText() = default;
16
+ NodeText(const NodeText &other);
17
+ NodeText(NodeText &&other) noexcept;
18
+ ~NodeText();
19
+ NodeText &operator=(const NodeText &other);
20
+ NodeText &operator=(NodeText &&other) noexcept;
21
+ NodeText &operator=(const std::string &text)
22
+ {
23
+ assign(text.c_str());
24
+ return *this;
25
+ }
26
+ NodeText &operator=(const char *text)
27
+ {
28
+ assign(text);
29
+ return *this;
30
+ }
31
+ // Pool allocation payload (including spare slots/map), excluding string
32
+ // character buffers and allocator metadata. Useful alongside heap census.
33
+ static std::size_t storageBytes();
34
+ void clear();
35
+ void assign(const char *text);
36
+ bool empty() const { return handle_ == kEmpty; }
37
+ const std::string &str() const;
38
+ operator const std::string &() const { return str(); }
39
+ const char *c_str() const { return str().c_str(); }
40
+ const char *data() const { return c_str(); }
41
+ std::size_t size() const { return str().size(); }
42
+ char operator[](std::size_t i) const { return str()[i]; }
43
+ std::size_t find(char c) const { return str().find(c); }
44
+ std::size_t find_first_not_of(const char *chars) const
45
+ {
46
+ return str().find_first_not_of(chars);
47
+ }
48
+ std::string substr(std::size_t pos,
49
+ std::size_t count = std::string::npos) const
50
+ {
51
+ return str().substr(pos, count);
52
+ }
53
+ friend bool operator==(const NodeText &a, const NodeText &b)
54
+ {
55
+ return a.str() == b.str();
56
+ }
57
+ friend bool operator==(const NodeText &a, const std::string &b)
58
+ {
59
+ return a.str() == b;
60
+ }
61
+ friend bool operator==(const NodeText &a, const char *b)
62
+ {
63
+ return a.str() == b;
64
+ }
65
+ friend bool operator!=(const NodeText &a, const NodeText &b)
66
+ {
67
+ return !(a == b);
68
+ }
69
+ friend bool operator!=(const NodeText &a, const std::string &b)
70
+ {
71
+ return !(a == b);
72
+ }
73
+ friend bool operator!=(const NodeText &a, const char *b)
74
+ {
75
+ return !(a == b);
76
+ }
77
+
78
+ private:
79
+ static constexpr std::uint32_t kEmpty = UINT32_MAX;
80
+ std::uint32_t handle_ = kEmpty;
81
+ };
82
+ } // namespace gea::embedded::ui