konpeito 0.1.0

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 (180) hide show
  1. checksums.yaml +7 -0
  2. data/.ruby-version +1 -0
  3. data/CHANGELOG.md +75 -0
  4. data/CONTRIBUTING.md +123 -0
  5. data/LICENSE +21 -0
  6. data/README.md +257 -0
  7. data/Rakefile +11 -0
  8. data/bin/konpeito +6 -0
  9. data/konpeito.gemspec +43 -0
  10. data/lib/konpeito/ast/typed_ast.rb +620 -0
  11. data/lib/konpeito/ast/visitor.rb +78 -0
  12. data/lib/konpeito/cache/cache_manager.rb +230 -0
  13. data/lib/konpeito/cache/dependency_graph.rb +192 -0
  14. data/lib/konpeito/cache.rb +8 -0
  15. data/lib/konpeito/cli/base_command.rb +187 -0
  16. data/lib/konpeito/cli/build_command.rb +220 -0
  17. data/lib/konpeito/cli/check_command.rb +104 -0
  18. data/lib/konpeito/cli/config.rb +231 -0
  19. data/lib/konpeito/cli/deps_command.rb +128 -0
  20. data/lib/konpeito/cli/doctor_command.rb +340 -0
  21. data/lib/konpeito/cli/fmt_command.rb +199 -0
  22. data/lib/konpeito/cli/init_command.rb +312 -0
  23. data/lib/konpeito/cli/lsp_command.rb +40 -0
  24. data/lib/konpeito/cli/run_command.rb +150 -0
  25. data/lib/konpeito/cli/test_command.rb +248 -0
  26. data/lib/konpeito/cli/watch_command.rb +212 -0
  27. data/lib/konpeito/cli.rb +301 -0
  28. data/lib/konpeito/codegen/builtin_methods.rb +229 -0
  29. data/lib/konpeito/codegen/cruby_backend.rb +1090 -0
  30. data/lib/konpeito/codegen/debug_info.rb +352 -0
  31. data/lib/konpeito/codegen/inliner.rb +486 -0
  32. data/lib/konpeito/codegen/jvm_backend.rb +197 -0
  33. data/lib/konpeito/codegen/jvm_generator.rb +13412 -0
  34. data/lib/konpeito/codegen/llvm_generator.rb +13191 -0
  35. data/lib/konpeito/codegen/loop_optimizer.rb +363 -0
  36. data/lib/konpeito/codegen/monomorphizer.rb +359 -0
  37. data/lib/konpeito/codegen/profile_runtime.c +341 -0
  38. data/lib/konpeito/codegen/profiler.rb +99 -0
  39. data/lib/konpeito/compiler.rb +592 -0
  40. data/lib/konpeito/dependency_resolver.rb +296 -0
  41. data/lib/konpeito/diagnostics/collector.rb +127 -0
  42. data/lib/konpeito/diagnostics/diagnostic.rb +237 -0
  43. data/lib/konpeito/diagnostics/renderer.rb +144 -0
  44. data/lib/konpeito/formatter/formatter.rb +1214 -0
  45. data/lib/konpeito/hir/builder.rb +7167 -0
  46. data/lib/konpeito/hir/nodes.rb +2465 -0
  47. data/lib/konpeito/lsp/document_manager.rb +820 -0
  48. data/lib/konpeito/lsp/server.rb +183 -0
  49. data/lib/konpeito/lsp/transport.rb +38 -0
  50. data/lib/konpeito/parser/prism_adapter.rb +65 -0
  51. data/lib/konpeito/platform.rb +103 -0
  52. data/lib/konpeito/profile/report.rb +136 -0
  53. data/lib/konpeito/rbs_inline/preprocessor.rb +199 -0
  54. data/lib/konpeito/stdlib/compression/compression.rb +72 -0
  55. data/lib/konpeito/stdlib/compression/compression.rbs +60 -0
  56. data/lib/konpeito/stdlib/compression/compression_native.c +415 -0
  57. data/lib/konpeito/stdlib/compression/extconf.rb +19 -0
  58. data/lib/konpeito/stdlib/crypto/crypto.rb +85 -0
  59. data/lib/konpeito/stdlib/crypto/crypto.rbs +74 -0
  60. data/lib/konpeito/stdlib/crypto/crypto_native.c +312 -0
  61. data/lib/konpeito/stdlib/crypto/extconf.rb +40 -0
  62. data/lib/konpeito/stdlib/http/extconf.rb +19 -0
  63. data/lib/konpeito/stdlib/http/http.rb +125 -0
  64. data/lib/konpeito/stdlib/http/http.rbs +57 -0
  65. data/lib/konpeito/stdlib/http/http_native.c +440 -0
  66. data/lib/konpeito/stdlib/json/extconf.rb +17 -0
  67. data/lib/konpeito/stdlib/json/json.rb +44 -0
  68. data/lib/konpeito/stdlib/json/json.rbs +33 -0
  69. data/lib/konpeito/stdlib/json/json_native.c +286 -0
  70. data/lib/konpeito/stdlib/ui/extconf.rb +216 -0
  71. data/lib/konpeito/stdlib/ui/konpeito_ui_native.cpp +1625 -0
  72. data/lib/konpeito/stdlib/ui/konpeito_ui_native.h +162 -0
  73. data/lib/konpeito/stdlib/ui/ui.rb +318 -0
  74. data/lib/konpeito/stdlib/ui/ui.rbs +247 -0
  75. data/lib/konpeito/type_checker/annotation_parser.rb +67 -0
  76. data/lib/konpeito/type_checker/hm_inferrer.rb +2565 -0
  77. data/lib/konpeito/type_checker/inferrer.rb +565 -0
  78. data/lib/konpeito/type_checker/rbs_loader.rb +1621 -0
  79. data/lib/konpeito/type_checker/type_resolver.rb +276 -0
  80. data/lib/konpeito/type_checker/types.rb +1434 -0
  81. data/lib/konpeito/type_checker/unification.rb +323 -0
  82. data/lib/konpeito/ui/animation/animated_state.rb +80 -0
  83. data/lib/konpeito/ui/animation/easing.rb +59 -0
  84. data/lib/konpeito/ui/animation/value_tween.rb +66 -0
  85. data/lib/konpeito/ui/app.rb +379 -0
  86. data/lib/konpeito/ui/box.rb +38 -0
  87. data/lib/konpeito/ui/castella.rb +70 -0
  88. data/lib/konpeito/ui/castella_native.rb +76 -0
  89. data/lib/konpeito/ui/chart/area_chart.rb +305 -0
  90. data/lib/konpeito/ui/chart/bar_chart.rb +288 -0
  91. data/lib/konpeito/ui/chart/base_chart.rb +210 -0
  92. data/lib/konpeito/ui/chart/chart_helpers.rb +79 -0
  93. data/lib/konpeito/ui/chart/gauge_chart.rb +171 -0
  94. data/lib/konpeito/ui/chart/heatmap_chart.rb +222 -0
  95. data/lib/konpeito/ui/chart/line_chart.rb +289 -0
  96. data/lib/konpeito/ui/chart/pie_chart.rb +219 -0
  97. data/lib/konpeito/ui/chart/scales.rb +77 -0
  98. data/lib/konpeito/ui/chart/scatter_chart.rb +303 -0
  99. data/lib/konpeito/ui/chart/stacked_bar_chart.rb +276 -0
  100. data/lib/konpeito/ui/column.rb +271 -0
  101. data/lib/konpeito/ui/core.rb +2199 -0
  102. data/lib/konpeito/ui/dsl.rb +443 -0
  103. data/lib/konpeito/ui/frame.rb +171 -0
  104. data/lib/konpeito/ui/frame_native.rb +494 -0
  105. data/lib/konpeito/ui/markdown/ast.rb +124 -0
  106. data/lib/konpeito/ui/markdown/mermaid/layout.rb +387 -0
  107. data/lib/konpeito/ui/markdown/mermaid/models.rb +232 -0
  108. data/lib/konpeito/ui/markdown/mermaid/parser.rb +519 -0
  109. data/lib/konpeito/ui/markdown/mermaid/renderer.rb +336 -0
  110. data/lib/konpeito/ui/markdown/parser.rb +805 -0
  111. data/lib/konpeito/ui/markdown/renderer.rb +639 -0
  112. data/lib/konpeito/ui/markdown/theme.rb +165 -0
  113. data/lib/konpeito/ui/render_node.rb +260 -0
  114. data/lib/konpeito/ui/row.rb +207 -0
  115. data/lib/konpeito/ui/spacer.rb +18 -0
  116. data/lib/konpeito/ui/style.rb +799 -0
  117. data/lib/konpeito/ui/theme.rb +563 -0
  118. data/lib/konpeito/ui/themes/material.rb +35 -0
  119. data/lib/konpeito/ui/themes/tokyo_night.rb +6 -0
  120. data/lib/konpeito/ui/widgets/button.rb +103 -0
  121. data/lib/konpeito/ui/widgets/calendar.rb +1034 -0
  122. data/lib/konpeito/ui/widgets/checkbox.rb +119 -0
  123. data/lib/konpeito/ui/widgets/container.rb +91 -0
  124. data/lib/konpeito/ui/widgets/data_table.rb +667 -0
  125. data/lib/konpeito/ui/widgets/divider.rb +29 -0
  126. data/lib/konpeito/ui/widgets/image.rb +105 -0
  127. data/lib/konpeito/ui/widgets/input.rb +485 -0
  128. data/lib/konpeito/ui/widgets/markdown.rb +57 -0
  129. data/lib/konpeito/ui/widgets/modal.rb +163 -0
  130. data/lib/konpeito/ui/widgets/multiline_input.rb +968 -0
  131. data/lib/konpeito/ui/widgets/multiline_text.rb +180 -0
  132. data/lib/konpeito/ui/widgets/net_image.rb +100 -0
  133. data/lib/konpeito/ui/widgets/progress_bar.rb +70 -0
  134. data/lib/konpeito/ui/widgets/radio_buttons.rb +93 -0
  135. data/lib/konpeito/ui/widgets/slider.rb +133 -0
  136. data/lib/konpeito/ui/widgets/switch.rb +84 -0
  137. data/lib/konpeito/ui/widgets/tabs.rb +157 -0
  138. data/lib/konpeito/ui/widgets/text.rb +110 -0
  139. data/lib/konpeito/ui/widgets/tree.rb +426 -0
  140. data/lib/konpeito/version.rb +5 -0
  141. data/lib/konpeito.rb +109 -0
  142. data/test_native_array.rb +172 -0
  143. data/test_native_array_class.rb +197 -0
  144. data/test_native_class.rb +151 -0
  145. data/tools/konpeito-asm/build.sh +65 -0
  146. data/tools/konpeito-asm/lib/asm-9.7.1.jar +0 -0
  147. data/tools/konpeito-asm/runtime-classes/konpeito/runtime/KArray.class +0 -0
  148. data/tools/konpeito-asm/runtime-classes/konpeito/runtime/KCompression.class +0 -0
  149. data/tools/konpeito-asm/runtime-classes/konpeito/runtime/KConditionVariable.class +0 -0
  150. data/tools/konpeito-asm/runtime-classes/konpeito/runtime/KCrypto.class +0 -0
  151. data/tools/konpeito-asm/runtime-classes/konpeito/runtime/KFile.class +0 -0
  152. data/tools/konpeito-asm/runtime-classes/konpeito/runtime/KHTTP.class +0 -0
  153. data/tools/konpeito-asm/runtime-classes/konpeito/runtime/KHash.class +0 -0
  154. data/tools/konpeito-asm/runtime-classes/konpeito/runtime/KJSON$Parser.class +0 -0
  155. data/tools/konpeito-asm/runtime-classes/konpeito/runtime/KJSON.class +0 -0
  156. data/tools/konpeito-asm/runtime-classes/konpeito/runtime/KMath.class +0 -0
  157. data/tools/konpeito-asm/runtime-classes/konpeito/runtime/KRactor.class +0 -0
  158. data/tools/konpeito-asm/runtime-classes/konpeito/runtime/KRactorPort.class +0 -0
  159. data/tools/konpeito-asm/runtime-classes/konpeito/runtime/KSizedQueue.class +0 -0
  160. data/tools/konpeito-asm/runtime-classes/konpeito/runtime/KThread.class +0 -0
  161. data/tools/konpeito-asm/runtime-classes/konpeito/runtime/KTime.class +0 -0
  162. data/tools/konpeito-asm/runtime-classes/konpeito/runtime/RubyDispatch.class +0 -0
  163. data/tools/konpeito-asm/src/ClassIntrospector.java +312 -0
  164. data/tools/konpeito-asm/src/KonpeitoAssembler.java +659 -0
  165. data/tools/konpeito-asm/src/konpeito/runtime/KArray.java +390 -0
  166. data/tools/konpeito-asm/src/konpeito/runtime/KCompression.java +168 -0
  167. data/tools/konpeito-asm/src/konpeito/runtime/KConditionVariable.java +48 -0
  168. data/tools/konpeito-asm/src/konpeito/runtime/KCrypto.java +151 -0
  169. data/tools/konpeito-asm/src/konpeito/runtime/KFile.java +100 -0
  170. data/tools/konpeito-asm/src/konpeito/runtime/KHTTP.java +113 -0
  171. data/tools/konpeito-asm/src/konpeito/runtime/KHash.java +228 -0
  172. data/tools/konpeito-asm/src/konpeito/runtime/KJSON.java +405 -0
  173. data/tools/konpeito-asm/src/konpeito/runtime/KMath.java +54 -0
  174. data/tools/konpeito-asm/src/konpeito/runtime/KRactor.java +244 -0
  175. data/tools/konpeito-asm/src/konpeito/runtime/KRactorPort.java +53 -0
  176. data/tools/konpeito-asm/src/konpeito/runtime/KSizedQueue.java +49 -0
  177. data/tools/konpeito-asm/src/konpeito/runtime/KThread.java +49 -0
  178. data/tools/konpeito-asm/src/konpeito/runtime/KTime.java +53 -0
  179. data/tools/konpeito-asm/src/konpeito/runtime/RubyDispatch.java +416 -0
  180. metadata +267 -0
@@ -0,0 +1,162 @@
1
+ /*
2
+ * Konpeito UI Native - SDL3 + Skia C API header
3
+ *
4
+ * Provides window management, event polling, and 2D drawing
5
+ * for the Castella UI framework on the LLVM backend.
6
+ */
7
+
8
+ #ifndef KONPEITO_UI_NATIVE_H
9
+ #define KONPEITO_UI_NATIVE_H
10
+
11
+ #include <stdint.h>
12
+ #include <stdbool.h>
13
+
14
+ #ifdef __cplusplus
15
+ extern "C" {
16
+ #endif
17
+
18
+ /* Opaque handle to the UI context (window + canvas + event queue) */
19
+ typedef struct KUIContext KUIContext;
20
+
21
+ /* --- Event types (matches JWM/Castella conventions) --- */
22
+ #define KUI_EVENT_NONE 0
23
+ #define KUI_EVENT_MOUSE_DOWN 1
24
+ #define KUI_EVENT_MOUSE_UP 2
25
+ #define KUI_EVENT_MOUSE_MOVE 3
26
+ #define KUI_EVENT_MOUSE_WHEEL 4
27
+ #define KUI_EVENT_KEY_DOWN 5
28
+ #define KUI_EVENT_KEY_UP 6
29
+ #define KUI_EVENT_TEXT_INPUT 7
30
+ #define KUI_EVENT_RESIZE 8
31
+ #define KUI_EVENT_IME_PREEDIT 9
32
+ #define KUI_EVENT_QUIT 10
33
+
34
+ /* --- Key modifier flags (matches JWM conventions) --- */
35
+ #define KUI_MOD_SHIFT 1
36
+ #define KUI_MOD_CONTROL 2
37
+ #define KUI_MOD_ALT 4
38
+ #define KUI_MOD_SUPER 8 /* Command on macOS */
39
+
40
+ /* --- Event ring buffer entry --- */
41
+ typedef struct {
42
+ int type;
43
+ double x, y; /* mouse position or scroll delta */
44
+ double dx, dy; /* scroll delta for wheel events */
45
+ int button; /* mouse button (0=left, 1=middle, 2=right) */
46
+ int key_code; /* JWM-compatible key ordinal */
47
+ int modifiers; /* modifier flags */
48
+ char text[128]; /* text input or IME preedit text */
49
+ int ime_sel_start; /* IME selection start */
50
+ int ime_sel_end; /* IME selection end */
51
+ } KUIEvent;
52
+
53
+ /* Max events in ring buffer */
54
+ #define KUI_EVENT_BUFFER_SIZE 256
55
+
56
+ /* --- Window management --- */
57
+ KUIContext* kui_create_window(const char* title, int width, int height);
58
+ void kui_destroy_window(KUIContext* ctx);
59
+ void kui_step(KUIContext* ctx); /* Poll SDL events into ring buffer */
60
+
61
+ /* --- Event access (scalar field getters, no struct passing) --- */
62
+ bool kui_has_event(KUIContext* ctx);
63
+ int kui_event_type(KUIContext* ctx);
64
+ double kui_event_x(KUIContext* ctx);
65
+ double kui_event_y(KUIContext* ctx);
66
+ double kui_event_dx(KUIContext* ctx);
67
+ double kui_event_dy(KUIContext* ctx);
68
+ int kui_event_button(KUIContext* ctx);
69
+ int kui_event_key_code(KUIContext* ctx);
70
+ int kui_event_modifiers(KUIContext* ctx);
71
+ const char* kui_event_text(KUIContext* ctx);
72
+ int kui_event_ime_sel_start(KUIContext* ctx);
73
+ int kui_event_ime_sel_end(KUIContext* ctx);
74
+ void kui_consume_event(KUIContext* ctx);
75
+
76
+ /* --- Frame management (Skia canvas begin/end) --- */
77
+ void kui_begin_frame(KUIContext* ctx);
78
+ void kui_end_frame(KUIContext* ctx);
79
+
80
+ /* --- Drawing primitives --- */
81
+ void kui_clear(KUIContext* ctx, uint32_t color);
82
+ void kui_fill_rect(KUIContext* ctx, double x, double y, double w, double h, uint32_t color);
83
+ void kui_stroke_rect(KUIContext* ctx, double x, double y, double w, double h, uint32_t color, double stroke_width);
84
+ void kui_fill_round_rect(KUIContext* ctx, double x, double y, double w, double h, double r, uint32_t color);
85
+ void kui_stroke_round_rect(KUIContext* ctx, double x, double y, double w, double h, double r, uint32_t color, double stroke_width);
86
+ void kui_fill_circle(KUIContext* ctx, double cx, double cy, double r, uint32_t color);
87
+ void kui_stroke_circle(KUIContext* ctx, double cx, double cy, double r, uint32_t color, double stroke_width);
88
+ void kui_draw_line(KUIContext* ctx, double x1, double y1, double x2, double y2, uint32_t color, double width);
89
+ void kui_fill_arc(KUIContext* ctx, double cx, double cy, double r, double start_angle, double sweep_angle, uint32_t color);
90
+ void kui_stroke_arc(KUIContext* ctx, double cx, double cy, double r, double start_angle, double sweep_angle, uint32_t color, double stroke_width);
91
+ void kui_fill_triangle(KUIContext* ctx, double x1, double y1, double x2, double y2, double x3, double y3, uint32_t color);
92
+
93
+ /* --- Text drawing --- */
94
+ void kui_draw_text(KUIContext* ctx, const char* text, double x, double y,
95
+ const char* font_family, double font_size, uint32_t color);
96
+ void kui_draw_text_styled(KUIContext* ctx, const char* text, double x, double y,
97
+ const char* font_family, double font_size, uint32_t color,
98
+ int weight, int slant);
99
+
100
+ /* --- Text measurement --- */
101
+ double kui_measure_text_width(KUIContext* ctx, const char* text, const char* font_family, double font_size);
102
+ double kui_measure_text_height(KUIContext* ctx, const char* font_family, double font_size);
103
+ double kui_get_text_ascent(KUIContext* ctx, const char* font_family, double font_size);
104
+
105
+ /* --- Path drawing --- */
106
+ void kui_begin_path(KUIContext* ctx);
107
+ void kui_path_move_to(KUIContext* ctx, double x, double y);
108
+ void kui_path_line_to(KUIContext* ctx, double x, double y);
109
+ void kui_close_fill_path(KUIContext* ctx, uint32_t color);
110
+ void kui_fill_path(KUIContext* ctx, uint32_t color);
111
+
112
+ /* --- Canvas state --- */
113
+ void kui_save(KUIContext* ctx);
114
+ void kui_restore(KUIContext* ctx);
115
+ void kui_translate(KUIContext* ctx, double dx, double dy);
116
+ void kui_clip_rect(KUIContext* ctx, double x, double y, double w, double h);
117
+
118
+ /* --- Image operations --- */
119
+ int kui_load_image(KUIContext* ctx, const char* path);
120
+ int kui_load_net_image(KUIContext* ctx, const char* url);
121
+ void kui_draw_image(KUIContext* ctx, int image_id, double x, double y, double w, double h);
122
+ double kui_get_image_width(KUIContext* ctx, int image_id);
123
+ double kui_get_image_height(KUIContext* ctx, int image_id);
124
+
125
+ /* --- Color utilities --- */
126
+ uint32_t kui_interpolate_color(uint32_t c1, uint32_t c2, double t);
127
+ uint32_t kui_with_alpha(uint32_t color, int alpha);
128
+ uint32_t kui_lighten_color(uint32_t color, double amount);
129
+ uint32_t kui_darken_color(uint32_t color, double amount);
130
+
131
+ /* --- Window queries --- */
132
+ double kui_get_width(KUIContext* ctx);
133
+ double kui_get_height(KUIContext* ctx);
134
+ double kui_get_scale(KUIContext* ctx);
135
+ bool kui_is_dark_mode(KUIContext* ctx);
136
+ void kui_request_frame(KUIContext* ctx);
137
+ void kui_mark_dirty(KUIContext* ctx);
138
+
139
+ /* --- IME / Text Input --- */
140
+ void kui_set_text_input_enabled(KUIContext* ctx, bool enabled);
141
+ void kui_set_text_input_rect(KUIContext* ctx, int x, int y, int w, int h);
142
+
143
+ /* --- Clipboard --- */
144
+ const char* kui_get_clipboard_text(KUIContext* ctx);
145
+ void kui_set_clipboard_text(KUIContext* ctx, const char* text);
146
+
147
+ /* --- Utilities --- */
148
+ int64_t kui_current_time_millis(void);
149
+ const char* kui_number_to_string(double value);
150
+
151
+ /* --- Math helpers (mirrors KUIRuntime.java) --- */
152
+ double kui_math_cos(double radians);
153
+ double kui_math_sin(double radians);
154
+ double kui_math_sqrt(double value);
155
+ double kui_math_atan2(double y, double x);
156
+ double kui_math_abs(double value);
157
+
158
+ #ifdef __cplusplus
159
+ }
160
+ #endif
161
+
162
+ #endif /* KONPEITO_UI_NATIVE_H */
@@ -0,0 +1,318 @@
1
+ # KonpeitoUI - Native UI runtime module (SDL3 + Skia)
2
+ #
3
+ # Ruby fallback stub for when the native extension is not available.
4
+ # This module provides the same interface as the C++ extension but
5
+ # raises an error when called, directing users to build the extension.
6
+
7
+ module KonpeitoUI
8
+ # Event type constants
9
+ EVENT_NONE = 0
10
+ EVENT_MOUSE_DOWN = 1
11
+ EVENT_MOUSE_UP = 2
12
+ EVENT_MOUSE_MOVE = 3
13
+ EVENT_MOUSE_WHEEL = 4
14
+ EVENT_KEY_DOWN = 5
15
+ EVENT_KEY_UP = 6
16
+ EVENT_TEXT_INPUT = 7
17
+ EVENT_RESIZE = 8
18
+ EVENT_IME_PREEDIT = 9
19
+ EVENT_QUIT = 10
20
+
21
+ # Modifier constants
22
+ MOD_SHIFT = 1
23
+ MOD_CONTROL = 2
24
+ MOD_ALT = 4
25
+ MOD_SUPER = 8
26
+
27
+ class << self
28
+ def create_window(title, width, height)
29
+ raise_not_available
30
+ end
31
+
32
+ def destroy_window(handle)
33
+ raise_not_available
34
+ end
35
+
36
+ def step(handle)
37
+ raise_not_available
38
+ end
39
+
40
+ def has_event(handle)
41
+ raise_not_available
42
+ end
43
+
44
+ def event_type(handle)
45
+ raise_not_available
46
+ end
47
+
48
+ def event_x(handle)
49
+ raise_not_available
50
+ end
51
+
52
+ def event_y(handle)
53
+ raise_not_available
54
+ end
55
+
56
+ def event_dx(handle)
57
+ raise_not_available
58
+ end
59
+
60
+ def event_dy(handle)
61
+ raise_not_available
62
+ end
63
+
64
+ def event_button(handle)
65
+ raise_not_available
66
+ end
67
+
68
+ def event_key_code(handle)
69
+ raise_not_available
70
+ end
71
+
72
+ def event_modifiers(handle)
73
+ raise_not_available
74
+ end
75
+
76
+ def event_text(handle)
77
+ raise_not_available
78
+ end
79
+
80
+ def event_ime_sel_start(handle)
81
+ raise_not_available
82
+ end
83
+
84
+ def event_ime_sel_end(handle)
85
+ raise_not_available
86
+ end
87
+
88
+ def consume_event(handle)
89
+ raise_not_available
90
+ end
91
+
92
+ def begin_frame(handle)
93
+ raise_not_available
94
+ end
95
+
96
+ def end_frame(handle)
97
+ raise_not_available
98
+ end
99
+
100
+ def clear(handle, color)
101
+ raise_not_available
102
+ end
103
+
104
+ def fill_rect(handle, x, y, w, h, color)
105
+ raise_not_available
106
+ end
107
+
108
+ def stroke_rect(handle, x, y, w, h, color, stroke_width)
109
+ raise_not_available
110
+ end
111
+
112
+ def fill_round_rect(handle, x, y, w, h, r, color)
113
+ raise_not_available
114
+ end
115
+
116
+ def stroke_round_rect(handle, x, y, w, h, r, color, stroke_width)
117
+ raise_not_available
118
+ end
119
+
120
+ def fill_circle(handle, cx, cy, r, color)
121
+ raise_not_available
122
+ end
123
+
124
+ def stroke_circle(handle, cx, cy, r, color, stroke_width)
125
+ raise_not_available
126
+ end
127
+
128
+ def draw_line(handle, x1, y1, x2, y2, color, width)
129
+ raise_not_available
130
+ end
131
+
132
+ def fill_arc(handle, cx, cy, r, start_angle, sweep_angle, color)
133
+ raise_not_available
134
+ end
135
+
136
+ def stroke_arc(handle, cx, cy, r, start_angle, sweep_angle, color, stroke_width)
137
+ raise_not_available
138
+ end
139
+
140
+ def fill_triangle(handle, x1, y1, x2, y2, x3, y3, color)
141
+ raise_not_available
142
+ end
143
+
144
+ def draw_text(handle, text, x, y, font_family, font_size, color)
145
+ raise_not_available
146
+ end
147
+
148
+ def draw_text_styled(handle, text, x, y, font_family, font_size, color, weight, slant)
149
+ raise_not_available
150
+ end
151
+
152
+ def measure_text_width(handle, text, font_family, font_size)
153
+ raise_not_available
154
+ end
155
+
156
+ def measure_text_height(handle, font_family, font_size)
157
+ raise_not_available
158
+ end
159
+
160
+ def get_text_ascent(handle, font_family, font_size)
161
+ raise_not_available
162
+ end
163
+
164
+ def begin_path(handle)
165
+ raise_not_available
166
+ end
167
+
168
+ def path_move_to(handle, x, y)
169
+ raise_not_available
170
+ end
171
+
172
+ def path_line_to(handle, x, y)
173
+ raise_not_available
174
+ end
175
+
176
+ def close_fill_path(handle, color)
177
+ raise_not_available
178
+ end
179
+
180
+ def fill_path(handle, color)
181
+ raise_not_available
182
+ end
183
+
184
+ def save(handle)
185
+ raise_not_available
186
+ end
187
+
188
+ def restore(handle)
189
+ raise_not_available
190
+ end
191
+
192
+ def translate(handle, dx, dy)
193
+ raise_not_available
194
+ end
195
+
196
+ def clip_rect(handle, x, y, w, h)
197
+ raise_not_available
198
+ end
199
+
200
+ def load_image(handle, path)
201
+ raise_not_available
202
+ end
203
+
204
+ def load_net_image(handle, url)
205
+ raise_not_available
206
+ end
207
+
208
+ def draw_image(handle, image_id, x, y, w, h)
209
+ raise_not_available
210
+ end
211
+
212
+ def get_image_width(handle, image_id)
213
+ raise_not_available
214
+ end
215
+
216
+ def get_image_height(handle, image_id)
217
+ raise_not_available
218
+ end
219
+
220
+ def interpolate_color(c1, c2, t)
221
+ raise_not_available
222
+ end
223
+
224
+ def with_alpha(color, alpha)
225
+ raise_not_available
226
+ end
227
+
228
+ def lighten_color(color, amount)
229
+ raise_not_available
230
+ end
231
+
232
+ def darken_color(color, amount)
233
+ raise_not_available
234
+ end
235
+
236
+ def get_width(handle)
237
+ raise_not_available
238
+ end
239
+
240
+ def get_height(handle)
241
+ raise_not_available
242
+ end
243
+
244
+ def get_scale(handle)
245
+ raise_not_available
246
+ end
247
+
248
+ def is_dark_mode(handle)
249
+ raise_not_available
250
+ end
251
+
252
+ def request_frame(handle)
253
+ raise_not_available
254
+ end
255
+
256
+ def mark_dirty(handle)
257
+ raise_not_available
258
+ end
259
+
260
+ def set_text_input_enabled(handle, enabled)
261
+ raise_not_available
262
+ end
263
+
264
+ def set_text_input_rect(handle, x, y, w, h)
265
+ raise_not_available
266
+ end
267
+
268
+ def get_clipboard_text(handle)
269
+ raise_not_available
270
+ end
271
+
272
+ def set_clipboard_text(handle, text)
273
+ raise_not_available
274
+ end
275
+
276
+ def current_time_millis
277
+ (Time.now.to_f * 1000).to_i
278
+ end
279
+
280
+ def number_to_string(value)
281
+ value.to_s
282
+ end
283
+
284
+ def math_cos(radians)
285
+ Math.cos(radians)
286
+ end
287
+
288
+ def math_sin(radians)
289
+ Math.sin(radians)
290
+ end
291
+
292
+ def math_sqrt(value)
293
+ Math.sqrt(value)
294
+ end
295
+
296
+ def math_atan2(y, x)
297
+ Math.atan2(y, x)
298
+ end
299
+
300
+ def math_abs(value)
301
+ value.abs
302
+ end
303
+
304
+ private
305
+
306
+ def raise_not_available
307
+ raise RuntimeError, <<~MSG
308
+ KonpeitoUI native extension not available.
309
+ Build it with:
310
+ cd lib/konpeito/stdlib/ui && ruby extconf.rb && make
311
+
312
+ Prerequisites:
313
+ macOS: brew install sdl3 && export SKIA_DIR=/path/to/skia
314
+ Linux: sudo apt install libsdl3-dev && export SKIA_DIR=/path/to/skia
315
+ MSG
316
+ end
317
+ end
318
+ end