hokusai-zero 0.2.6 → 0.2.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.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/Gemfile.lock +0 -2
- data/README.md +1 -1
- data/ast/src/core/ast.c +3 -11
- data/ast/src/core/hml.c +212 -40
- data/ast/src/core/hml.h +1 -0
- data/ast/src/core/input.h +0 -1
- data/ast/src/core/log.c +87 -0
- data/ast/src/core/log.h +41 -0
- data/ast/src/core/util.c +23 -23
- data/ast/src/core/util.h +7 -7
- data/ast/test/parser.c +1 -0
- data/ext/extconf.rb +6 -6
- data/hokusai.gemspec +1 -2
- data/ui/examples/drag.rb +154 -0
- data/ui/examples/embedded.rb +58 -0
- data/ui/examples/forum/file.rb +1 -1
- data/ui/examples/forum/post.rb +0 -1
- data/ui/examples/forum.rb +7 -7
- data/ui/examples/game.rb +143 -0
- data/ui/examples/keyboard.rb +47 -0
- data/ui/examples/overlay.rb +233 -0
- data/ui/examples/provider.rb +56 -0
- data/ui/examples/shader/test.rb +155 -0
- data/ui/examples/shader.rb +100 -0
- data/ui/examples/spreadsheet.rb +12 -11
- data/ui/examples/wiki.rb +82 -0
- data/ui/lib/lib_hokusai.rb +43 -24
- data/ui/spec/hokusai/e2e/keyboard_spec.rb +52 -0
- data/ui/spec/spec_helper.rb +1 -1
- data/ui/src/hokusai/assets/arrow-down-line.png +0 -0
- data/ui/src/hokusai/assets/arrow-down-wide-line.png +0 -0
- data/ui/src/hokusai/assets/icons/outline/arrow-big-up.svg +19 -0
- data/ui/src/hokusai/assets/icons/outline/backspace.svg +20 -0
- data/ui/src/hokusai/automation/driver_commands/base.rb +2 -8
- data/ui/src/hokusai/automation/driver_commands/trigger_keyboard.rb +3 -6
- data/ui/src/hokusai/automation/driver_commands/trigger_mouse.rb +12 -5
- data/ui/src/hokusai/automation/server.rb +2 -3
- data/ui/src/hokusai/backends/raylib/config.rb +2 -1
- data/ui/src/hokusai/backends/raylib/font.rb +24 -3
- data/ui/src/hokusai/backends/raylib.rb +167 -36
- data/ui/src/hokusai/backends/sdl2/config.rb +9 -6
- data/ui/src/hokusai/backends/sdl2/font.rb +3 -1
- data/ui/src/hokusai/backends/sdl2.rb +188 -93
- data/ui/src/hokusai/blocks/color_picker.rb +1080 -0
- data/ui/src/hokusai/blocks/input.rb +2 -2
- data/ui/src/hokusai/blocks/keyboard.rb +249 -0
- data/ui/src/hokusai/blocks/shader_begin.rb +22 -0
- data/ui/src/hokusai/blocks/shader_end.rb +12 -0
- data/ui/src/hokusai/blocks/slider.rb +139 -0
- data/ui/src/hokusai/blocks/texture.rb +23 -0
- data/ui/src/hokusai/commands/rect.rb +12 -3
- data/ui/src/hokusai/commands/shader.rb +33 -0
- data/ui/src/hokusai/commands/texture.rb +26 -0
- data/ui/src/hokusai/commands.rb +22 -0
- data/ui/src/hokusai/event.rb +2 -1
- data/ui/src/hokusai/events/keyboard.rb +11 -18
- data/ui/src/hokusai/events/mouse.rb +10 -8
- data/ui/src/hokusai/events/touch.rb +62 -0
- data/ui/src/hokusai/meta.rb +9 -4
- data/ui/src/hokusai/mounting/loop_entry.rb +1 -1
- data/ui/src/hokusai/mounting/update_entry.rb +7 -6
- data/ui/src/hokusai/painter.rb +31 -8
- data/ui/src/hokusai/types/display.rb +151 -0
- data/ui/src/hokusai/types/keyboard.rb +168 -0
- data/ui/src/hokusai/types/mouse.rb +36 -0
- data/ui/src/hokusai/types/primitives.rb +56 -0
- data/ui/src/hokusai/types/touch.rb +181 -0
- data/ui/src/hokusai/types.rb +20 -244
- data/ui/src/hokusai/util/wrap_stream.rb +193 -0
- data/ui/src/hokusai.rb +61 -35
- data/xmake.lua +2 -1
- metadata +34 -22
- data/ui/src/hokusai/assets/chevron-down.svg +0 -1
data/ui/src/hokusai.rb
CHANGED
@@ -13,45 +13,11 @@ require_relative './hokusai/event'
|
|
13
13
|
require_relative './hokusai/painter'
|
14
14
|
require_relative './hokusai/util/selection'
|
15
15
|
require_relative './hokusai/util/piece_table'
|
16
|
-
require_relative './hokusai/blocks/empty'
|
17
|
-
require_relative './hokusai/blocks/vblock'
|
18
|
-
require_relative './hokusai/blocks/hblock'
|
19
|
-
require_relative './hokusai/blocks/label'
|
20
|
-
require_relative './hokusai/blocks/rect'
|
21
|
-
require_relative './hokusai/blocks/button'
|
22
|
-
require_relative './hokusai/blocks/circle'
|
23
|
-
require_relative './hokusai/blocks/checkbox'
|
24
|
-
require_relative './hokusai/blocks/scissor_begin'
|
25
|
-
require_relative './hokusai/blocks/scissor_end'
|
26
|
-
require_relative './hokusai/blocks/clipped'
|
27
|
-
require_relative './hokusai/blocks/cursor'
|
28
|
-
require_relative './hokusai/blocks/image'
|
29
|
-
require_relative './hokusai/blocks/svg'
|
30
|
-
require_relative './hokusai/blocks/toggle'
|
31
|
-
require_relative './hokusai/blocks/scrollbar'
|
32
|
-
require_relative './hokusai/blocks/dynamic'
|
33
|
-
require_relative './hokusai/blocks/panel'
|
34
|
-
require_relative './hokusai/blocks/text'
|
35
|
-
require_relative './hokusai/blocks/selectable'
|
36
|
-
require_relative './hokusai/blocks/input'
|
37
|
-
require_relative './hokusai/blocks/variable'
|
38
|
-
require_relative './hokusai/blocks/titlebar/osx'
|
39
|
-
require_relative './hokusai/blocks/modal'
|
40
|
-
require_relative './hokusai/blocks/dropdown'
|
41
|
-
|
42
|
-
require "concurrent"
|
43
16
|
|
44
17
|
# A backend agnostic library for authoring
|
45
18
|
# desktop applications
|
46
19
|
# @author skinnyjames
|
47
20
|
module Hokusai
|
48
|
-
ThreadPool = Concurrent::ThreadPoolExecutor.new(
|
49
|
-
min_threads: 5,
|
50
|
-
max_threads: 5,
|
51
|
-
max_queue: 20,
|
52
|
-
fallback_policy: :caller_runs
|
53
|
-
)
|
54
|
-
|
55
21
|
SHADER_UNIFORM_FLOAT = 0 # Shader uniform type: float
|
56
22
|
SHADER_UNIFORM_VEC2 = 1 # Shader uniform type: vec2 (2 float)
|
57
23
|
SHADER_UNIFORM_VEC3 = 2 # Shader uniform type: vec3 (3 float)
|
@@ -65,6 +31,10 @@ module Hokusai
|
|
65
31
|
SHADER_UNIFORM_UIVEC3 = 10 # Shader uniform type: uivec3 (3 unsigned int)
|
66
32
|
SHADER_UNIFORM_UIVEC4 = 11 # Shader uniform type: uivec4 (4 unsigned int)
|
67
33
|
|
34
|
+
def self.asset(path)
|
35
|
+
"#{ASSETS_FOLDER}/#{path}"
|
36
|
+
end
|
37
|
+
|
68
38
|
# Access the font registry
|
69
39
|
#
|
70
40
|
# @return [Hokusai::FontRegistry]
|
@@ -166,4 +136,60 @@ module Hokusai
|
|
166
136
|
def self.set_mouse_cursor(type)
|
167
137
|
@on_set_mouse_cursor&.call(type)
|
168
138
|
end
|
169
|
-
|
139
|
+
|
140
|
+
# Mobile support
|
141
|
+
def self.on_show_keyboard(&block)
|
142
|
+
@on_show_keyboard = block
|
143
|
+
end
|
144
|
+
|
145
|
+
def self.show_keyboard
|
146
|
+
@on_show_keyboard&.call
|
147
|
+
end
|
148
|
+
|
149
|
+
def self.on_hide_keyboard(&block)
|
150
|
+
@on_hide_keyboard = block
|
151
|
+
end
|
152
|
+
|
153
|
+
def self.hide_keyboard
|
154
|
+
@on_hide_keyboard&.call
|
155
|
+
end
|
156
|
+
|
157
|
+
def self.on_keyboard_visible(&block)
|
158
|
+
@on_keyboard_visible = block
|
159
|
+
end
|
160
|
+
|
161
|
+
def self.keyboard_visible?
|
162
|
+
@on_keyboard_visible&.call
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
require_relative './hokusai/blocks/empty'
|
167
|
+
require_relative './hokusai/blocks/vblock'
|
168
|
+
require_relative './hokusai/blocks/hblock'
|
169
|
+
require_relative './hokusai/blocks/label'
|
170
|
+
require_relative './hokusai/blocks/rect'
|
171
|
+
require_relative './hokusai/blocks/button'
|
172
|
+
require_relative './hokusai/blocks/circle'
|
173
|
+
require_relative './hokusai/blocks/checkbox'
|
174
|
+
require_relative './hokusai/blocks/scissor_begin'
|
175
|
+
require_relative './hokusai/blocks/scissor_end'
|
176
|
+
require_relative './hokusai/blocks/clipped'
|
177
|
+
require_relative './hokusai/blocks/cursor'
|
178
|
+
require_relative './hokusai/blocks/image'
|
179
|
+
require_relative './hokusai/blocks/svg'
|
180
|
+
require_relative './hokusai/blocks/toggle'
|
181
|
+
require_relative './hokusai/blocks/scrollbar'
|
182
|
+
require_relative './hokusai/blocks/dynamic'
|
183
|
+
require_relative './hokusai/blocks/panel'
|
184
|
+
require_relative './hokusai/blocks/text'
|
185
|
+
require_relative './hokusai/blocks/selectable'
|
186
|
+
require_relative './hokusai/blocks/input'
|
187
|
+
require_relative './hokusai/blocks/variable'
|
188
|
+
require_relative './hokusai/blocks/titlebar/osx'
|
189
|
+
require_relative './hokusai/blocks/modal'
|
190
|
+
require_relative './hokusai/blocks/dropdown'
|
191
|
+
require_relative './hokusai/blocks/shader_begin'
|
192
|
+
require_relative './hokusai/blocks/shader_end'
|
193
|
+
require_relative './hokusai/blocks/texture'
|
194
|
+
require_relative './hokusai/blocks/color_picker'
|
195
|
+
require_relative './hokusai/blocks/keyboard'
|
data/xmake.lua
CHANGED
@@ -119,6 +119,7 @@ target("hokusai")
|
|
119
119
|
add_links("$(projectdir)/vendor/lib/libtree-sitter.a")
|
120
120
|
add_links("$(projectdir)/vendor/lib/libmd4c.a")
|
121
121
|
add_files(
|
122
|
+
"ast/src/core/log.c",
|
122
123
|
"ast/src/core/hml.c",
|
123
124
|
"ast/src/core/ast.c",
|
124
125
|
"ast/src/core/style.c",
|
@@ -159,7 +160,7 @@ target("test-ast")
|
|
159
160
|
)
|
160
161
|
-- add_cflags("-Wall -Werror")
|
161
162
|
after_build(function(target)
|
162
|
-
os.exec("./%s -t
|
163
|
+
os.exec("./%s -t input", target:targetfile())
|
163
164
|
-- os.exec("leaks -atExit -- %s", target:targetfile())
|
164
165
|
end)
|
165
166
|
target_end()
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hokusai-zero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- skinnyjames
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: ffi
|
@@ -24,20 +23,6 @@ dependencies:
|
|
24
23
|
- - "~>"
|
25
24
|
- !ruby/object:Gem::Version
|
26
25
|
version: '1.16'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: concurrent-ruby
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.3.4
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 1.3.4
|
41
26
|
- !ruby/object:Gem::Dependency
|
42
27
|
name: raylib-bindings
|
43
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,7 +79,6 @@ dependencies:
|
|
94
79
|
- - ">="
|
95
80
|
- !ruby/object:Gem::Version
|
96
81
|
version: '0'
|
97
|
-
description:
|
98
82
|
email: zero@skinnyjames.net
|
99
83
|
executables: []
|
100
84
|
extensions:
|
@@ -119,6 +103,8 @@ files:
|
|
119
103
|
- ast/src/core/hml.h
|
120
104
|
- ast/src/core/input.c
|
121
105
|
- ast/src/core/input.h
|
106
|
+
- ast/src/core/log.c
|
107
|
+
- ast/src/core/log.h
|
122
108
|
- ast/src/core/style.c
|
123
109
|
- ast/src/core/style.h
|
124
110
|
- ast/src/core/text.c
|
@@ -181,17 +167,26 @@ files:
|
|
181
167
|
- ui/examples/buddy.rb
|
182
168
|
- ui/examples/clock.rb
|
183
169
|
- ui/examples/counter.rb
|
170
|
+
- ui/examples/drag.rb
|
184
171
|
- ui/examples/dynamic.rb
|
172
|
+
- ui/examples/embedded.rb
|
185
173
|
- ui/examples/foobar.rb
|
186
174
|
- ui/examples/forum.rb
|
187
175
|
- ui/examples/forum/file.rb
|
188
176
|
- ui/examples/forum/music.rb
|
189
177
|
- ui/examples/forum/post.rb
|
178
|
+
- ui/examples/game.rb
|
179
|
+
- ui/examples/keyboard.rb
|
180
|
+
- ui/examples/overlay.rb
|
181
|
+
- ui/examples/provider.rb
|
182
|
+
- ui/examples/shader.rb
|
183
|
+
- ui/examples/shader/test.rb
|
190
184
|
- ui/examples/spreadsheet.rb
|
191
185
|
- ui/examples/spreadsheet/csv.rb
|
192
186
|
- ui/examples/stock.rb
|
193
187
|
- ui/examples/stock_decider/option.rb
|
194
188
|
- ui/examples/tic_tac_toe.rb
|
189
|
+
- ui/examples/wiki.rb
|
195
190
|
- ui/lib/lib_hokusai.rb
|
196
191
|
- ui/spec/hokusai/ast_spec.rb
|
197
192
|
- ui/spec/hokusai/automation/keys_transcoder_spec.rb
|
@@ -200,6 +195,7 @@ files:
|
|
200
195
|
- ui/spec/hokusai/diff_spec.rb
|
201
196
|
- ui/spec/hokusai/directives_spec.rb
|
202
197
|
- ui/spec/hokusai/e2e/client_spec.rb
|
198
|
+
- ui/spec/hokusai/e2e/keyboard_spec.rb
|
203
199
|
- ui/spec/hokusai/e2e/meta_spec.rb
|
204
200
|
- ui/spec/hokusai/providers_spec.rb
|
205
201
|
- ui/spec/hokusai/publisher_spec.rb
|
@@ -208,9 +204,12 @@ files:
|
|
208
204
|
- ui/spec/hokusai_spec.rb
|
209
205
|
- ui/spec/spec_helper.rb
|
210
206
|
- ui/src/hokusai.rb
|
207
|
+
- ui/src/hokusai/assets/arrow-down-line.png
|
208
|
+
- ui/src/hokusai/assets/arrow-down-wide-line.png
|
211
209
|
- ui/src/hokusai/assets/arrow-drop-down-line.png
|
212
|
-
- ui/src/hokusai/assets/chevron-down.svg
|
213
210
|
- ui/src/hokusai/assets/close-large-line.png
|
211
|
+
- ui/src/hokusai/assets/icons/outline/arrow-big-up.svg
|
212
|
+
- ui/src/hokusai/assets/icons/outline/backspace.svg
|
214
213
|
- ui/src/hokusai/ast.rb
|
215
214
|
- ui/src/hokusai/automation.rb
|
216
215
|
- ui/src/hokusai/automation/client.rb
|
@@ -242,6 +241,7 @@ files:
|
|
242
241
|
- ui/src/hokusai/blocks/checkbox.rb
|
243
242
|
- ui/src/hokusai/blocks/circle.rb
|
244
243
|
- ui/src/hokusai/blocks/clipped.rb
|
244
|
+
- ui/src/hokusai/blocks/color_picker.rb
|
245
245
|
- ui/src/hokusai/blocks/cursor.rb
|
246
246
|
- ui/src/hokusai/blocks/dropdown.rb
|
247
247
|
- ui/src/hokusai/blocks/dynamic.rb
|
@@ -249,6 +249,7 @@ files:
|
|
249
249
|
- ui/src/hokusai/blocks/hblock.rb
|
250
250
|
- ui/src/hokusai/blocks/image.rb
|
251
251
|
- ui/src/hokusai/blocks/input.rb
|
252
|
+
- ui/src/hokusai/blocks/keyboard.rb
|
252
253
|
- ui/src/hokusai/blocks/label.rb
|
253
254
|
- ui/src/hokusai/blocks/modal.rb
|
254
255
|
- ui/src/hokusai/blocks/panel.rb
|
@@ -257,8 +258,12 @@ files:
|
|
257
258
|
- ui/src/hokusai/blocks/scissor_end.rb
|
258
259
|
- ui/src/hokusai/blocks/scrollbar.rb
|
259
260
|
- ui/src/hokusai/blocks/selectable.rb
|
261
|
+
- ui/src/hokusai/blocks/shader_begin.rb
|
262
|
+
- ui/src/hokusai/blocks/shader_end.rb
|
263
|
+
- ui/src/hokusai/blocks/slider.rb
|
260
264
|
- ui/src/hokusai/blocks/svg.rb
|
261
265
|
- ui/src/hokusai/blocks/text.rb
|
266
|
+
- ui/src/hokusai/blocks/texture.rb
|
262
267
|
- ui/src/hokusai/blocks/titlebar/osx.rb
|
263
268
|
- ui/src/hokusai/blocks/toggle.rb
|
264
269
|
- ui/src/hokusai/blocks/variable.rb
|
@@ -269,12 +274,15 @@ files:
|
|
269
274
|
- ui/src/hokusai/commands/image.rb
|
270
275
|
- ui/src/hokusai/commands/rect.rb
|
271
276
|
- ui/src/hokusai/commands/scissor.rb
|
277
|
+
- ui/src/hokusai/commands/shader.rb
|
272
278
|
- ui/src/hokusai/commands/text.rb
|
279
|
+
- ui/src/hokusai/commands/texture.rb
|
273
280
|
- ui/src/hokusai/diff.rb
|
274
281
|
- ui/src/hokusai/error.rb
|
275
282
|
- ui/src/hokusai/event.rb
|
276
283
|
- ui/src/hokusai/events/keyboard.rb
|
277
284
|
- ui/src/hokusai/events/mouse.rb
|
285
|
+
- ui/src/hokusai/events/touch.rb
|
278
286
|
- ui/src/hokusai/font.rb
|
279
287
|
- ui/src/hokusai/meta.rb
|
280
288
|
- ui/src/hokusai/mounting/loop_entry.rb
|
@@ -286,9 +294,15 @@ files:
|
|
286
294
|
- ui/src/hokusai/publisher.rb
|
287
295
|
- ui/src/hokusai/style.rb
|
288
296
|
- ui/src/hokusai/types.rb
|
297
|
+
- ui/src/hokusai/types/display.rb
|
298
|
+
- ui/src/hokusai/types/keyboard.rb
|
299
|
+
- ui/src/hokusai/types/mouse.rb
|
300
|
+
- ui/src/hokusai/types/primitives.rb
|
301
|
+
- ui/src/hokusai/types/touch.rb
|
289
302
|
- ui/src/hokusai/util/clamping_iterator.rb
|
290
303
|
- ui/src/hokusai/util/piece_table.rb
|
291
304
|
- ui/src/hokusai/util/selection.rb
|
305
|
+
- ui/src/hokusai/util/wrap_stream.rb
|
292
306
|
- ui/vendor/.gitkeep
|
293
307
|
- vendor/.gitkeep
|
294
308
|
- xmake.lua
|
@@ -297,7 +311,6 @@ licenses:
|
|
297
311
|
- MIT
|
298
312
|
metadata:
|
299
313
|
source_code_uri: https://codeberg.org/skinnyjames/hokusai
|
300
|
-
post_install_message:
|
301
314
|
rdoc_options: []
|
302
315
|
require_paths:
|
303
316
|
- ui/src
|
@@ -312,8 +325,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
312
325
|
- !ruby/object:Gem::Version
|
313
326
|
version: '0'
|
314
327
|
requirements: []
|
315
|
-
rubygems_version: 3.
|
316
|
-
signing_key:
|
328
|
+
rubygems_version: 3.6.7
|
317
329
|
specification_version: 4
|
318
330
|
summary: A Ruby library for writing GUI applications
|
319
331
|
test_files: []
|
@@ -1 +0,0 @@
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><title>finite-icons</title><path d="M13.60851,6.08611L8.35425,11.339,3.06908,6.05389a0.5,0.5,0,0,1,0-.70711l0.539-.539a0.5,0.5,0,0,1,.70711,0l4.03907,4.039L12.36249,4.8399a0.5,0.5,0,0,1,.70705.00006l0.539,0.539A0.5,0.5,0,0,1,13.60851,6.08611Z" fill="#231f20"/></svg>
|