hokusai-zero 0.1.6 → 0.1.8
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 +19 -21
- data/LICENSE +4 -180
- data/README.md +3 -3
- data/ext/extconf.rb +1 -1
- data/hokusai.gemspec +3 -3
- data/ui/spec/hokusai/providers_spec.rb +215 -0
- data/ui/spec/spec_helper.rb +26 -0
- data/ui/src/hokusai/automation/driver_commands/get_attribute.rb +1 -1
- data/ui/src/hokusai/automation/driver_commands/locate.rb +2 -2
- data/ui/src/hokusai/automation/driver_commands/trigger_keyboard.rb +1 -1
- data/ui/src/hokusai/automation.rb +0 -1
- data/ui/src/hokusai/block.rb +2 -6
- data/ui/src/hokusai/blocks/selectable.rb +3 -3
- data/ui/src/hokusai/mounting/loop_entry.rb +4 -4
- data/ui/src/hokusai/mounting/mount_entry.rb +17 -12
- data/ui/src/hokusai/mounting/update_entry.rb +6 -6
- data/ui/src/hokusai/node_mounter.rb +16 -5
- data/ui/src/hokusai/painter.rb +0 -1
- data/ui/src/hokusai/util/clamping_iterator.rb +68 -26
- metadata +18 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a8faa36e8e87e04ec56f0c7278cea29f0e9597c35cdba792aa15a7011977185
|
4
|
+
data.tar.gz: eea4aae01d1918a8dbcddbed19920dff7ad017aca9acdf9dcb764d9dc1a583ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 324846d89b6884d3499011a90d852b1c45e01e81ada56ebb4e348f4e7236d78c74db9b037789d57fcca3e49b5bcecbde49e461dacb26d5c04a2b8efe539b6fdf
|
7
|
+
data.tar.gz: d37fbe243acfb7947b29b4eff62f632aba7b2e87745fbba8593fa561e5c278ed286e54f3531e4480acfd0426bb8cce7bf431dec58a23a593a712dbaafd8671ef
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
GIT
|
2
2
|
remote: https://github.com/ffi/ffi.git
|
3
|
-
revision:
|
3
|
+
revision: 467081ef62b655d5bea51d0f33f5c6e7f57baa46
|
4
4
|
submodules: true
|
5
5
|
specs:
|
6
|
-
ffi (1.17.
|
6
|
+
ffi (1.17.2)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://www.rubygems.org/
|
10
10
|
specs:
|
11
|
-
|
12
|
-
concurrent-ruby (1.3.4)
|
11
|
+
concurrent-ruby (1.3.5)
|
13
12
|
daemons (1.4.1)
|
14
|
-
diff-lcs (1.
|
13
|
+
diff-lcs (1.6.1)
|
15
14
|
domain_name (0.6.20240107)
|
16
15
|
eventmachine (1.2.7)
|
17
16
|
http-accept (1.7.0)
|
@@ -20,24 +19,24 @@ GEM
|
|
20
19
|
listen (3.9.0)
|
21
20
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
22
21
|
rb-inotify (~> 0.9, >= 0.9.10)
|
23
|
-
logger (1.
|
22
|
+
logger (1.7.0)
|
24
23
|
memory_profiler (1.1.0)
|
25
|
-
mime-types (3.
|
24
|
+
mime-types (3.7.0)
|
26
25
|
logger
|
27
|
-
mime-types-data (~> 3.
|
28
|
-
mime-types-data (3.
|
26
|
+
mime-types-data (~> 3.2025, >= 3.2025.0507)
|
27
|
+
mime-types-data (3.2025.0507)
|
29
28
|
mini_portile2 (2.0.0)
|
30
29
|
netrc (0.11.0)
|
31
|
-
rack (2.2.
|
32
|
-
raylib-bindings (0.7.
|
30
|
+
rack (2.2.14)
|
31
|
+
raylib-bindings (0.7.12)
|
33
32
|
ffi (~> 1.16)
|
34
|
-
raylib-bindings (0.7.
|
33
|
+
raylib-bindings (0.7.12-aarch64-linux)
|
35
34
|
ffi (~> 1.16)
|
36
|
-
raylib-bindings (0.7.
|
35
|
+
raylib-bindings (0.7.12-arm64-darwin)
|
37
36
|
ffi (~> 1.16)
|
38
|
-
raylib-bindings (0.7.
|
37
|
+
raylib-bindings (0.7.12-x86_64-darwin)
|
39
38
|
ffi (~> 1.16)
|
40
|
-
raylib-bindings (0.7.
|
39
|
+
raylib-bindings (0.7.12-x86_64-linux)
|
41
40
|
ffi (~> 1.16)
|
42
41
|
rb-fsevent (0.11.2)
|
43
42
|
rb-inotify (0.11.1)
|
@@ -53,15 +52,15 @@ GEM
|
|
53
52
|
rspec-core (~> 3.13.0)
|
54
53
|
rspec-expectations (~> 3.13.0)
|
55
54
|
rspec-mocks (~> 3.13.0)
|
56
|
-
rspec-core (3.13.
|
55
|
+
rspec-core (3.13.3)
|
57
56
|
rspec-support (~> 3.13.0)
|
58
|
-
rspec-expectations (3.13.
|
57
|
+
rspec-expectations (3.13.4)
|
59
58
|
diff-lcs (>= 1.2.0, < 2.0)
|
60
59
|
rspec-support (~> 3.13.0)
|
61
|
-
rspec-mocks (3.13.
|
60
|
+
rspec-mocks (3.13.4)
|
62
61
|
diff-lcs (>= 1.2.0, < 2.0)
|
63
62
|
rspec-support (~> 3.13.0)
|
64
|
-
rspec-support (3.13.
|
63
|
+
rspec-support (3.13.3)
|
65
64
|
sdl2-bindings (0.2.3)
|
66
65
|
ffi (~> 1.15)
|
67
66
|
thin (1.8.0)
|
@@ -78,7 +77,6 @@ PLATFORMS
|
|
78
77
|
x86_64-linux
|
79
78
|
|
80
79
|
DEPENDENCIES
|
81
|
-
colorize
|
82
80
|
concurrent-ruby
|
83
81
|
ffi!
|
84
82
|
memory_profiler
|
@@ -92,4 +90,4 @@ DEPENDENCIES
|
|
92
90
|
yard
|
93
91
|
|
94
92
|
BUNDLED WITH
|
95
|
-
2.
|
93
|
+
2.6.8
|
data/LICENSE
CHANGED
@@ -1,183 +1,7 @@
|
|
1
|
-
|
1
|
+
Copyright © 2025 <Sean Gregory>
|
2
2
|
|
3
|
-
|
4
|
-
ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED IN THIS LICENSE,
|
5
|
-
YOU AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN AS
|
6
|
-
CONSIDERATION FOR ACCEPTING THE TERMS AND CONDITIONS OF THIS LICENSE AND FOR AGREEING TO BE BOUND BY THE TERMS AND CONDITIONS OF THIS LICENSE.
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
7
4
|
|
8
|
-
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
9
6
|
|
10
|
-
|
11
|
-
rrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other
|
12
|
-
form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a
|
13
|
-
Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram,
|
14
|
-
the synchronization of the Work in timed-relation with a moving image (“synching”) will be considered an Adaptation for the purpose of this License.
|
15
|
-
|
16
|
-
b. “Collection” means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts,
|
17
|
-
or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents,
|
18
|
-
constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions,
|
19
|
-
each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection
|
20
|
-
will not be considered an Adaptation (as defined above) for the purposes of this License.
|
21
|
-
|
22
|
-
c. “Distribute” means to make available to the public the original and copies of the Work or Adaptation, as appropriate, through sale, gift or any other
|
23
|
-
transfer of possession or ownership.
|
24
|
-
|
25
|
-
d. “Licensor” means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License.
|
26
|
-
|
27
|
-
e. “Original Author” means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or
|
28
|
-
if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers,
|
29
|
-
and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii)
|
30
|
-
in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of
|
31
|
-
broadcasts, the organization that transmits the broadcast.
|
32
|
-
|
33
|
-
f. “Work” means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and
|
34
|
-
artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or
|
35
|
-
other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words;
|
36
|
-
a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving
|
37
|
-
or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch
|
38
|
-
or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected
|
39
|
-
as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work.
|
40
|
-
|
41
|
-
g. “You” means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work,
|
42
|
-
or who has received express permission from the Licensor to exercise rights under this License despite a previous violation.
|
43
|
-
|
44
|
-
h. “Publicly Perform” means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process,
|
45
|
-
including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access
|
46
|
-
these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to
|
47
|
-
the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images.
|
48
|
-
|
49
|
-
i. “Reproduce” means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations
|
50
|
-
of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium.
|
51
|
-
|
52
|
-
2. FAIR DEALING RIGHTS
|
53
|
-
|
54
|
-
Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for
|
55
|
-
in connection with the copyright protection under copyright law or other applicable laws.
|
56
|
-
|
57
|
-
3. LICENSE GRANT
|
58
|
-
|
59
|
-
Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual
|
60
|
-
(for the duration of the applicable copyright) license to exercise the rights in the Work as stated below:
|
61
|
-
|
62
|
-
a. to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections;
|
63
|
-
|
64
|
-
b. to create and Reproduce Adaptations provided that any such Adaptation, including any translation in any medium, takes reasonable steps to clearly label,
|
65
|
-
demarcate or otherwise identify that changes were made to the original Work. For example, a translation could be marked “The original work was translated
|
66
|
-
from English to Spanish,” or a modification could indicate “The original work has been modified.”;
|
67
|
-
|
68
|
-
c. to Distribute and Publicly Perform the Work including as incorporated in Collections; and,
|
69
|
-
|
70
|
-
d. to Distribute and Publicly Perform Adaptations. The above rights may be exercised in all media and formats whether now known or hereafter devised.
|
71
|
-
The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. Subject to Section 8(f), all
|
72
|
-
rights not expressly granted by Licensor are hereby reserved, including but not limited to the rights set forth in Section 4(f).
|
73
|
-
|
74
|
-
4. RESTRICTIONS
|
75
|
-
|
76
|
-
The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:
|
77
|
-
|
78
|
-
a. You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for,
|
79
|
-
this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License
|
80
|
-
or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must
|
81
|
-
keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute
|
82
|
-
or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise
|
83
|
-
the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection
|
84
|
-
apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable,
|
85
|
-
remove from the Collection any credit as required by Section 4(d), as requested. If You create an Adaptation, upon notice from any Licensor You must, to the extent practicable,
|
86
|
-
remove from the Adaptation any credit as required by Section 4(d), as requested.
|
87
|
-
|
88
|
-
b. Subject to the exception in Section 4(c), you may not exercise any of the rights granted to You in Section 3 above in any manner that is primarily intended for or
|
89
|
-
directed toward commercial advantage or private monetary compensation. The exchange of the Work for other copyrighted works by means of digital file-sharing or
|
90
|
-
otherwise shall not be considered to be intended for or directed toward commercial advantage or private monetary compensation, provided there is no payment of
|
91
|
-
any monetary compensation in connection with the exchange of copyrighted works.
|
92
|
-
|
93
|
-
c. You may exercise the rights granted in Section 3 for commercial purposes only if:
|
94
|
-
|
95
|
-
i. You are a worker-owned business or worker-owned collective; and
|
96
|
-
ii. all financial gain, surplus, profits and benefits produced by the business or collective are distributed among the worker-owners
|
97
|
-
|
98
|
-
d. Any use by a business that is privately owned and managed, and that seeks to generate profit from the labor of employees paid by salary or other wages, is not permitted under this license.
|
99
|
-
|
100
|
-
e. If You Distribute, or Publicly Perform the Work or any Adaptations or Collections, You must, unless a request has been made pursuant to Section 4(a),
|
101
|
-
keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable)
|
102
|
-
if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution (“Attribution Parties”)
|
103
|
-
in Licensor’s copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii)
|
104
|
-
to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice
|
105
|
-
or licensing information for the Work; and, (iv) consistent with Section 3(b), in the case of an Adaptation, a credit identifying the use of the Work in the Adaptation
|
106
|
-
(e.g., “French translation of the Work by Original Author,” or “Screenplay based on original Work by Original Author”). The credit required by this Section 4(d) may be
|
107
|
-
implemented in any reasonable manner; provided, however, that in the case of a Adaptation or Collection, at a minimum such credit will appear, if a credit
|
108
|
-
for all contributing authors of the Adaptation or Collection appears, then as part of these credits and in a manner at least as prominent as the credits for
|
109
|
-
the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner
|
110
|
-
set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or
|
111
|
-
endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express
|
112
|
-
prior written permission of the Original Author, Licensor and/or Attribution Parties.
|
113
|
-
|
114
|
-
f. For the avoidance of doubt:
|
115
|
-
|
116
|
-
i. Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing
|
117
|
-
scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License;
|
118
|
-
|
119
|
-
ii. Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing
|
120
|
-
scheme can be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License
|
121
|
-
if Your exercise of such rights is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(b) and otherwise waives the right
|
122
|
-
to collect royalties through any statutory or compulsory licensing scheme; and,
|
123
|
-
|
124
|
-
iii.Voluntary License Schemes. The Licensor reserves the right to collect royalties, whether individually or, in the event that the Licensor is a member
|
125
|
-
of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License
|
126
|
-
that is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(b).
|
127
|
-
|
128
|
-
g. Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or
|
129
|
-
Publicly Perform the Work either by itself or as part of any Adaptations or Collections, You must not distort, mutilate, modify or take other derogatory
|
130
|
-
action in relation to the Work which would be prejudicial to the Original Author’s honor or reputation. Licensor agrees that in those jurisdictions (e.g. Japan),
|
131
|
-
in which any exercise of the right granted in Section 3(b) of this License (the right to make Adaptations) would be deemed to be a distortion, mutilation, modification
|
132
|
-
or other derogatory action prejudicial to the Original Author’s honor and reputation, the Licensor will waive or not assert, as appropriate, this Section,
|
133
|
-
to the fullest extent permitted by the applicable national law, to enable You to reasonably exercise Your right under Section 3(b) of this License (right to make Adaptations)
|
134
|
-
but not otherwise.
|
135
|
-
|
136
|
-
5. REPRESENTATIONS, WARRANTIES AND DISCLAIMER
|
137
|
-
|
138
|
-
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED,
|
139
|
-
STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS,
|
140
|
-
ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
|
141
|
-
|
142
|
-
6. LIMITATION ON LIABILITY
|
143
|
-
|
144
|
-
EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES
|
145
|
-
ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
146
|
-
|
147
|
-
7. TERMINATION
|
148
|
-
|
149
|
-
a. This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Adaptations
|
150
|
-
or Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with
|
151
|
-
those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License.
|
152
|
-
|
153
|
-
b. Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work).
|
154
|
-
Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time;
|
155
|
-
provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be,
|
156
|
-
granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above.
|
157
|
-
|
158
|
-
8. MISCELLANEOUS
|
159
|
-
|
160
|
-
a. Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and
|
161
|
-
conditions as the license granted to You under this License.
|
162
|
-
|
163
|
-
b. Each time You Distribute or Publicly Perform an Adaptation, Licensor offers to the recipient a license to the original Work on the same terms and conditions
|
164
|
-
as the license granted to You under this License.
|
165
|
-
|
166
|
-
c. If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder
|
167
|
-
of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary
|
168
|
-
to make such provision valid and enforceable.
|
169
|
-
|
170
|
-
d. No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed
|
171
|
-
by the party to be charged with such waiver or consent.
|
172
|
-
|
173
|
-
e. This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or
|
174
|
-
representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication
|
175
|
-
from You. This License may not be modified without the mutual written agreement of the Licensor and You.
|
176
|
-
|
177
|
-
f. The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for
|
178
|
-
the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996,
|
179
|
-
the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject
|
180
|
-
matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the
|
181
|
-
implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes
|
182
|
-
additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict
|
183
|
-
the license of any rights under applicable law.
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -5,14 +5,14 @@ A Ruby library for authoring GUI applications
|
|
5
5
|
[](https://ci.skinnyjames.net/skinnyjames/hokusai)
|
6
6
|
[](https://hokusai.skinnyjames.net)
|
7
7
|
[](https://skinnyjames.codeberg.page/hokusai/)
|
8
|
-
[](https://mit-license.org/)
|
9
9
|
|
10
10
|
## Getting started
|
11
11
|
|
12
12
|
In your Gemfile
|
13
13
|
|
14
14
|
```ruby
|
15
|
-
gem "hokusai-zero", "0.1.
|
15
|
+
gem "hokusai-zero", "0.1.8"
|
16
16
|
```
|
17
17
|
|
18
18
|
## In order to run an application, you will need to install a backend
|
@@ -132,4 +132,4 @@ Steps:
|
|
132
132
|
|
133
133
|
## License
|
134
134
|
|
135
|
-
Hokusai is released under the [
|
135
|
+
Hokusai is released under the [MIT License](https://mit-license.org/)
|
data/ext/extconf.rb
CHANGED
@@ -77,7 +77,7 @@ File.open("Makefile", "w") do |io|
|
|
77
77
|
|
78
78
|
hokusai:
|
79
79
|
#{"\t"}#{mkdir}
|
80
|
-
#{"\t"}gcc -c $(includes) $(src_files) $(libraries)
|
80
|
+
#{"\t"}gcc #{cflags} -c $(includes) $(src_files) $(libraries)
|
81
81
|
#{"\t"}gcc #{cflags} $(includes) -o #{File.expand_path("#{pre}/vendor/lib/libhokusai.#{suffix}")} $(object_files) $(libraries)
|
82
82
|
|
83
83
|
clean:
|
data/hokusai.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'hokusai-zero'
|
3
|
-
s.version = '0.1.
|
4
|
-
s.licenses = ['
|
3
|
+
s.version = '0.1.8'
|
4
|
+
s.licenses = ['MIT']
|
5
5
|
s.summary = "A Ruby library for writing GUI applications"
|
6
6
|
s.authors = ["skinnyjames"]
|
7
7
|
s.email = 'zero@skinnyjames.net'
|
@@ -16,9 +16,9 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.metadata = { "source_code_uri" => "https://codeberg.org/skinnyjames/hokusai" }
|
17
17
|
|
18
18
|
s.add_dependency "ffi", "~> 1.16"
|
19
|
-
s.add_dependency "colorize"
|
20
19
|
s.add_dependency "concurrent-ruby", "~> 1.3.4"
|
21
20
|
s.add_dependency "raylib-bindings", "~> 0.7.9"
|
22
21
|
s.add_dependency "sdl2-bindings", "~> 0.2.3"
|
23
22
|
s.add_dependency "memory_profiler"
|
23
|
+
s.add_dependency "mini_portile2"
|
24
24
|
end
|
@@ -0,0 +1,215 @@
|
|
1
|
+
require_relative "../spec_helper"
|
2
|
+
|
3
|
+
describe "Providers" do
|
4
|
+
let(:counter) do
|
5
|
+
Class.new do
|
6
|
+
attr_reader :count
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@count = 0
|
10
|
+
end
|
11
|
+
|
12
|
+
def increment
|
13
|
+
@count += 1
|
14
|
+
end
|
15
|
+
|
16
|
+
def decrement
|
17
|
+
@count -= 1
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
let(:provider) do
|
23
|
+
counter_klass = counter
|
24
|
+
Class.new(Hokusai::Block) do
|
25
|
+
template <<~EOF
|
26
|
+
[template]
|
27
|
+
slot
|
28
|
+
EOF
|
29
|
+
|
30
|
+
provide :provision, counter_klass.new
|
31
|
+
|
32
|
+
def state
|
33
|
+
self.class.provides[:provision]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
let(:inject) do
|
39
|
+
Class.new(Hokusai::Block) do
|
40
|
+
template <<~EOF
|
41
|
+
[template]
|
42
|
+
virtual
|
43
|
+
EOF
|
44
|
+
|
45
|
+
inject :provision
|
46
|
+
|
47
|
+
def increment
|
48
|
+
provision.increment
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
let(:container) do
|
54
|
+
provider_klass = provider
|
55
|
+
inject_klass = inject
|
56
|
+
c = Class.new(Hokusai::Block) do
|
57
|
+
template <<~EOF
|
58
|
+
[template]
|
59
|
+
vblock
|
60
|
+
provision
|
61
|
+
vblock
|
62
|
+
inject
|
63
|
+
vblock
|
64
|
+
empty
|
65
|
+
vblock
|
66
|
+
control
|
67
|
+
EOF
|
68
|
+
|
69
|
+
uses(
|
70
|
+
vblock: Hokusai::Blocks::Vblock,
|
71
|
+
provision: provider_klass,
|
72
|
+
inject: inject_klass,
|
73
|
+
control: inject_klass,
|
74
|
+
empty: Hokusai::Blocks::Empty
|
75
|
+
)
|
76
|
+
end
|
77
|
+
|
78
|
+
c.mount
|
79
|
+
end
|
80
|
+
|
81
|
+
it "provisions can be injected into descendants" do
|
82
|
+
injected = get_block_by_type(container, "inject")
|
83
|
+
provided = get_block_by_type(container, "provision")
|
84
|
+
|
85
|
+
expect(injected.provision.count).to eq(0)
|
86
|
+
injected.provision.increment
|
87
|
+
|
88
|
+
expect(injected.provision.count).to eq(1)
|
89
|
+
expect(provided.state.count).to eq(1)
|
90
|
+
end
|
91
|
+
|
92
|
+
it "provisions aren't injected into non-descendants" do
|
93
|
+
injected = get_block_by_type(container, "control")
|
94
|
+
|
95
|
+
expect(injected.provision).to eql(nil)
|
96
|
+
end
|
97
|
+
|
98
|
+
describe "Loops" do
|
99
|
+
let(:loop_container) do
|
100
|
+
provider_klass = provider
|
101
|
+
inject_klass = inject
|
102
|
+
c = Class.new(Hokusai::Block) do
|
103
|
+
template <<~EOF
|
104
|
+
[template]
|
105
|
+
vblock
|
106
|
+
provision
|
107
|
+
[for="item in list"]
|
108
|
+
vblock
|
109
|
+
inject { :key="item" }
|
110
|
+
control
|
111
|
+
EOF
|
112
|
+
|
113
|
+
uses(
|
114
|
+
vblock: Hokusai::Blocks::Vblock,
|
115
|
+
control: inject_klass,
|
116
|
+
inject: inject_klass,
|
117
|
+
provision: provider_klass
|
118
|
+
)
|
119
|
+
|
120
|
+
def list
|
121
|
+
@list ||= [1,2,3,4]
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
c.mount
|
126
|
+
end
|
127
|
+
|
128
|
+
it "provisions extend to loop children" do
|
129
|
+
injected = get_blocks_by_type(loop_container, "inject")
|
130
|
+
provided = get_block_by_type(loop_container, "provision")
|
131
|
+
control = get_block_by_type(loop_container, "control")
|
132
|
+
|
133
|
+
expect(injected.first.provision.count).to eq(0)
|
134
|
+
injected.first.provision.increment
|
135
|
+
|
136
|
+
injected.each do |child|
|
137
|
+
expect(child.provision.count).to eq(1)
|
138
|
+
end
|
139
|
+
|
140
|
+
expect(control.provision).to be(nil)
|
141
|
+
expect(provided.state.count).to eq(1)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
describe "Conditionals" do
|
146
|
+
let(:conditional_container) do
|
147
|
+
provider_klass = provider
|
148
|
+
inject_klass = inject
|
149
|
+
c = Class.new(Hokusai::Block) do
|
150
|
+
template <<~EOF
|
151
|
+
[template]
|
152
|
+
container
|
153
|
+
provision
|
154
|
+
[if="show"]
|
155
|
+
vblock
|
156
|
+
inject
|
157
|
+
[else]
|
158
|
+
vblock
|
159
|
+
injectelse
|
160
|
+
control
|
161
|
+
EOF
|
162
|
+
|
163
|
+
uses(
|
164
|
+
container: Hokusai::Blocks::Vblock,
|
165
|
+
vblock: Hokusai::Blocks::Vblock,
|
166
|
+
control: inject_klass,
|
167
|
+
inject: inject_klass,
|
168
|
+
injectelse: inject_klass,
|
169
|
+
provision: provider_klass
|
170
|
+
)
|
171
|
+
|
172
|
+
attr_accessor :show
|
173
|
+
|
174
|
+
def initialize(**args)
|
175
|
+
@show = false
|
176
|
+
|
177
|
+
super
|
178
|
+
end
|
179
|
+
|
180
|
+
def toggle
|
181
|
+
self.show = !show
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
c.mount
|
186
|
+
end
|
187
|
+
|
188
|
+
it "provisions extend to conditional children" do
|
189
|
+
conditional_container.toggle
|
190
|
+
conditional_container.update
|
191
|
+
|
192
|
+
injected = get_block_by_type(conditional_container, "inject")
|
193
|
+
provided = get_block_by_type(conditional_container, "provision")
|
194
|
+
control = get_block_by_type(conditional_container, "control")
|
195
|
+
|
196
|
+
expect(injected.provision.count).to eq(0)
|
197
|
+
injected.provision.increment
|
198
|
+
|
199
|
+
expect(injected.provision.count).to eq(1)
|
200
|
+
expect(provided.state.count).to eq(1)
|
201
|
+
expect(control.provision).to be(nil)
|
202
|
+
|
203
|
+
conditional_container.toggle
|
204
|
+
conditional_container.update
|
205
|
+
|
206
|
+
inject_else = get_block_by_type(conditional_container, "injectelse")
|
207
|
+
|
208
|
+
expect(inject_else.provision).not_to be(nil)
|
209
|
+
expect(inject_else.provision.count).to eq(1)
|
210
|
+
inject_else.provision.increment
|
211
|
+
|
212
|
+
expect(provided.state.count).to eq(2)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
data/ui/spec/spec_helper.rb
CHANGED
@@ -3,6 +3,32 @@ require_relative "../src/hokusai/backends/raylib"
|
|
3
3
|
require_relative "../src/hokusai/automation"
|
4
4
|
require "thread"
|
5
5
|
|
6
|
+
def get_block_by_type(block, type)
|
7
|
+
return block if (block.node.ast.type == type) || (block.node.portal&.ast&.has_if_condition? && block.node.portal&.ast&.type == type)
|
8
|
+
|
9
|
+
block.children.each do |child|
|
10
|
+
if b = get_block_by_type(child, type)
|
11
|
+
return b
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
nil
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_blocks_by_type(block, type, results = [])
|
19
|
+
if block.node.ast.type == type
|
20
|
+
results << block
|
21
|
+
|
22
|
+
return
|
23
|
+
end
|
24
|
+
|
25
|
+
block.children.each do |child|
|
26
|
+
get_blocks_by_type(child, type, results)
|
27
|
+
end
|
28
|
+
|
29
|
+
results
|
30
|
+
end
|
31
|
+
|
6
32
|
def with_app(app, &block)
|
7
33
|
driver = Hokusai::Automation::Driver.new
|
8
34
|
|
@@ -30,7 +30,7 @@ module Hokusai::Automation
|
|
30
30
|
def execute(blocks, canvas, input)
|
31
31
|
return unless matches_block(blocks[0])
|
32
32
|
|
33
|
-
Log.debug { "Props: #{blocks[0].node.meta.props}"
|
33
|
+
Log.debug { "Props: #{blocks[0].node.meta.props}" }
|
34
34
|
|
35
35
|
attribute = blocks[0].node.meta.props[attribute_name.to_sym]
|
36
36
|
|
@@ -29,11 +29,11 @@ module Hokusai::Automation
|
|
29
29
|
def execute(blocks, canvas, input)
|
30
30
|
if selector = selectors.shift
|
31
31
|
if selector.matches(blocks[0])
|
32
|
-
Log.debug {"Location match! #{selector}"
|
32
|
+
Log.debug {"Location match! #{selector}" }
|
33
33
|
|
34
34
|
portal = blocks[0].node.portal
|
35
35
|
|
36
|
-
Log.debug { "uuid: #{portal.uuid.to_s}"
|
36
|
+
Log.debug { "uuid: #{portal.uuid.to_s}" }
|
37
37
|
|
38
38
|
matches << portal.uuid.to_s
|
39
39
|
|
@@ -28,7 +28,7 @@ module Hokusai::Automation
|
|
28
28
|
def execute(blocks, canvas, input)
|
29
29
|
return unless matches_block(blocks[0])
|
30
30
|
|
31
|
-
Log.info { "Trigger keypress on #{blocks[0].class}"
|
31
|
+
Log.info { "Trigger keypress on #{blocks[0].class}" }
|
32
32
|
|
33
33
|
decode_key = keys.shift
|
34
34
|
|
data/ui/src/hokusai/block.rb
CHANGED
@@ -18,11 +18,7 @@ module Hokusai
|
|
18
18
|
if block_given?
|
19
19
|
provides[name] = block
|
20
20
|
else
|
21
|
-
|
22
|
-
provides[name] = value
|
23
|
-
else
|
24
|
-
provides[name] = ->{value}
|
25
|
-
end
|
21
|
+
provides[name] = value
|
26
22
|
end
|
27
23
|
end
|
28
24
|
|
@@ -156,7 +152,7 @@ module Hokusai
|
|
156
152
|
@injections = {}
|
157
153
|
|
158
154
|
self.class.injectables.each do |name|
|
159
|
-
if value = args[:providers][name
|
155
|
+
if value = args[:providers]&.[](name)
|
160
156
|
@injections[name] = value
|
161
157
|
end
|
162
158
|
end
|
@@ -44,10 +44,10 @@ module Hokusai::Blocks
|
|
44
44
|
|
45
45
|
def update_selection(event)
|
46
46
|
return unless selection.active?
|
47
|
-
|
48
|
-
if event.left
|
47
|
+
|
48
|
+
if event.left.up
|
49
49
|
selection.freeze!
|
50
|
-
elsif event.left
|
50
|
+
elsif event.left.down
|
51
51
|
selection.stop(event.pos.x, event.pos.y)
|
52
52
|
end
|
53
53
|
end
|
@@ -27,7 +27,7 @@ module Hokusai
|
|
27
27
|
|
28
28
|
INDEX_KEY = "index".freeze
|
29
29
|
|
30
|
-
def_delegators :@entry, :ast, :block, :target, :parent, :
|
30
|
+
def_delegators :@entry, :ast, :block, :target, :parent, :mount_providers
|
31
31
|
|
32
32
|
def initialize(mount_entry)
|
33
33
|
@entry = mount_entry
|
@@ -68,7 +68,7 @@ module Hokusai
|
|
68
68
|
child_block = child_block_class.new(node: node)
|
69
69
|
child_block.node.add_styles(target.class)
|
70
70
|
child_block.node.add_props_from_block(target, context: ctx)
|
71
|
-
child_block.node.meta.
|
71
|
+
child_block.node.meta.set_prop(ast.loop.var.to_sym, value)
|
72
72
|
child_block.node.meta.publisher.add(target)
|
73
73
|
|
74
74
|
UpdateEntry.new(child_block, block, target).register(context: ctx)
|
@@ -78,12 +78,12 @@ module Hokusai
|
|
78
78
|
block.node.meta << child_block
|
79
79
|
|
80
80
|
node.ast.children.each_with_index do |child, idx|
|
81
|
-
entries_to_return << MountEntry.new(index, child, child_block, child_block, child_block, context: nil, providers:
|
81
|
+
entries_to_return << MountEntry.new(index, child, child_block, child_block, child_block, context: nil, providers: mount_providers.merge(child_block.providers))
|
82
82
|
end
|
83
83
|
|
84
84
|
siblings = []
|
85
85
|
portal.ast.children.each_with_index do |child, idx|
|
86
|
-
siblings << MountEntry.new(idx, child, child_block, child_block, target, context: ctx, providers:
|
86
|
+
siblings << MountEntry.new(idx, child, child_block, child_block, target, context: ctx, providers: mount_providers.merge(child_block.providers))
|
87
87
|
end
|
88
88
|
|
89
89
|
secondary_entries << siblings
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Hokusai
|
2
2
|
module Mounting
|
3
3
|
class MountEntry
|
4
|
-
attr_reader :block, :parent, :ast, :target, :index, :ctx
|
4
|
+
attr_reader :block, :parent, :ast, :target, :index, :ctx
|
5
5
|
|
6
6
|
def initialize(index, ast, block, parent, target = parent, context: nil, providers: {})
|
7
7
|
@index = index
|
@@ -13,6 +13,10 @@ module Hokusai
|
|
13
13
|
@ctx = context
|
14
14
|
end
|
15
15
|
|
16
|
+
def mount_providers
|
17
|
+
@providers
|
18
|
+
end
|
19
|
+
|
16
20
|
def loop?
|
17
21
|
ast.loop?
|
18
22
|
end
|
@@ -26,21 +30,22 @@ module Hokusai
|
|
26
30
|
end
|
27
31
|
|
28
32
|
def debug
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
str = <<~EOF
|
34
|
+
#{block.class} | #{ast.type} (#{index})
|
35
|
+
#{block.node.ast.children.map(&:type)}
|
36
|
+
providers: #{@providers.map {|k,v| k }.join(", ")}
|
37
|
+
parent: #{parent.class}
|
38
|
+
target: #{target.class}\n\n
|
39
|
+
EOF
|
36
40
|
end
|
37
41
|
|
38
42
|
def with_block(new_block, supercede_parent: false)
|
39
43
|
parent_block = supercede_parent ? block : parent
|
40
|
-
|
44
|
+
|
45
|
+
MountEntry.new(index, ast, new_block, parent_block, target, context: ctx, providers: mount_providers)
|
41
46
|
end
|
42
47
|
|
43
|
-
def mount(context: nil)
|
48
|
+
def mount(context: nil, providers: {})
|
44
49
|
klass = target.class.use(ast.type)
|
45
50
|
portal = Node.new(ast)
|
46
51
|
|
@@ -49,9 +54,9 @@ module Hokusai
|
|
49
54
|
node.add_props_from_block(target, context: context || ctx)
|
50
55
|
|
51
56
|
# handle provides / dependency injection
|
52
|
-
child_block = klass.new(node: node, providers: providers)
|
57
|
+
child_block = klass.new(node: node, providers: providers.merge(mount_providers))
|
53
58
|
child_block.node.meta.publisher.add(target) # todo
|
54
|
-
UpdateEntry.new(child_block, block, target).register(context: context || ctx)
|
59
|
+
UpdateEntry.new(child_block, block, target).register(context: context || ctx, providers: providers.merge(mount_providers))
|
55
60
|
|
56
61
|
block.node.meta << child_block
|
57
62
|
|
@@ -13,7 +13,7 @@ module Hokusai
|
|
13
13
|
block.node.meta
|
14
14
|
end
|
15
15
|
|
16
|
-
def register(context: nil)
|
16
|
+
def register(context: nil, providers: {})
|
17
17
|
meta.on_update(target) do |ublock, uparent, utarget|
|
18
18
|
if portal = ublock.node.portal
|
19
19
|
portal.ast.children.each_with_index do |child, index|
|
@@ -28,6 +28,7 @@ module Hokusai
|
|
28
28
|
else
|
29
29
|
visible = utarget.public_send(child.if.method)
|
30
30
|
end
|
31
|
+
|
31
32
|
child_block_klass = target.class.use(child.type)
|
32
33
|
|
33
34
|
if !!visible
|
@@ -39,14 +40,13 @@ module Hokusai
|
|
39
40
|
unless child_present.call(child)
|
40
41
|
portal = Node.new(child, Node.new(child))
|
41
42
|
node = child_block_klass.compile("root", portal)
|
42
|
-
|
43
43
|
stack = []
|
44
44
|
child.children.each_with_index do |ast, ast_index|
|
45
45
|
stack << MountEntry.new(ast_index, ast, ublock, uparent, utarget)
|
46
46
|
end
|
47
47
|
|
48
|
-
child_block = NodeMounter.new(node, child_block_klass, [stack]).mount(context: context)
|
49
|
-
UpdateEntry.new(child_block, block, target).register(context: context)
|
48
|
+
child_block = NodeMounter.new(node, child_block_klass, [stack]).mount(context: context, providers: providers)
|
49
|
+
UpdateEntry.new(child_block, block, target).register(context: context, providers: providers)
|
50
50
|
|
51
51
|
child_block.node.add_styles(target.class)
|
52
52
|
child_block.node.add_props_from_block(target, context: context)
|
@@ -75,8 +75,8 @@ module Hokusai
|
|
75
75
|
stack << MountEntry.new(ast_index, ast, ublock, uparent, utarget)
|
76
76
|
end
|
77
77
|
|
78
|
-
child_block = NodeMounter.new(node, else_child_block_klass, [stack]).mount(context: context)
|
79
|
-
UpdateEntry.new(child_block, block, utarget).register(context: context)
|
78
|
+
child_block = NodeMounter.new(node, else_child_block_klass, [stack]).mount(context: context, providers: providers)
|
79
|
+
UpdateEntry.new(child_block, block, utarget).register(context: context, providers: providers)
|
80
80
|
|
81
81
|
child_block.node.add_styles(utarget.class)
|
82
82
|
child_block.node.add_props_from_block(utarget, context: context)
|
@@ -9,6 +9,9 @@ module Hokusai
|
|
9
9
|
|
10
10
|
def initialize(node, klass, secondary_stack = [], previous_target = nil)
|
11
11
|
@root = klass.new(node: node)
|
12
|
+
|
13
|
+
raise Hokusai::Error.new("Root #{klass} doesn't have a node. Did you remember to call `super`?") if @root.node.nil?
|
14
|
+
|
12
15
|
@secondary_stack = secondary_stack
|
13
16
|
@primary_stack = []
|
14
17
|
|
@@ -17,7 +20,9 @@ module Hokusai
|
|
17
20
|
end
|
18
21
|
end
|
19
22
|
|
20
|
-
def mount(context: nil)
|
23
|
+
def mount(context: nil, providers: {})
|
24
|
+
mount_providers = providers.merge(root.providers)
|
25
|
+
|
21
26
|
while entry = primary_stack.shift
|
22
27
|
next if entry.virtual?
|
23
28
|
|
@@ -68,9 +73,14 @@ module Hokusai
|
|
68
73
|
next
|
69
74
|
end
|
70
75
|
|
71
|
-
entry.mount(context: context) do |child_block|
|
76
|
+
entry.mount(context: context, providers: mount_providers) do |child_block|
|
77
|
+
new_mount_providers = mount_providers
|
78
|
+
.merge(entry.mount_providers)
|
79
|
+
.merge(entry.block.providers)
|
80
|
+
.merge(child_block.providers)
|
81
|
+
|
72
82
|
# create a subentry to register event handling and prop passing
|
73
|
-
Mounting::UpdateEntry.new(child_block, entry.block, entry.target).register(context: context || entry.ctx)
|
83
|
+
Mounting::UpdateEntry.new(child_block, entry.block, entry.target).register(context: context || entry.ctx, providers: new_mount_providers)
|
74
84
|
|
75
85
|
# Populate the secondary stack with the portal children
|
76
86
|
# this stack will be used to populate any slots in the primary_stack
|
@@ -78,7 +88,8 @@ module Hokusai
|
|
78
88
|
|
79
89
|
entry.ast.children.each_with_index do |child, child_index|
|
80
90
|
child.has_if_condition?
|
81
|
-
|
91
|
+
|
92
|
+
items << Mounting::MountEntry.new(child_index, child, child_block, entry.parent, entry.target, context: entry.ctx, providers: new_mount_providers)
|
82
93
|
end
|
83
94
|
|
84
95
|
secondary_stack.unshift items
|
@@ -88,7 +99,7 @@ module Hokusai
|
|
88
99
|
primary_items = []
|
89
100
|
|
90
101
|
child_block.node.ast.children.each_with_index do |child, child_index|
|
91
|
-
primary_items << Mounting::MountEntry.new(child_index, child, child_block, child_block, context: entry.ctx, providers:
|
102
|
+
primary_items << Mounting::MountEntry.new(child_index, child, child_block, child_block, context: entry.ctx, providers: new_mount_providers)
|
92
103
|
end
|
93
104
|
|
94
105
|
self.primary_stack = primary_items + primary_stack
|
data/ui/src/hokusai/painter.rb
CHANGED
@@ -27,43 +27,85 @@ module Hokusai::Util
|
|
27
27
|
y = iterator.y
|
28
28
|
hit_box = Hokusai::Rect.new(0, 0, 0, 0)
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
if @iterator.clamping.markdown
|
31
|
+
segment.groups.each do |group|
|
32
|
+
group.chars.each do |char|
|
33
|
+
if can_render_inside(font_size, boundary) && segment.char_is_selected(char)
|
34
|
+
self.select_x ||= local_x
|
35
|
+
self.select_width = select_width.nil? ? char.width : (select_width + char.width)
|
36
|
+
|
37
|
+
if selector = selection
|
38
|
+
if segment.select_begin == char.offset && selector.up? && !iterator.cursor_set && !selector.started
|
39
|
+
iterator.cursor_position = [local_x, y, char.width, font_size.to_f]
|
40
|
+
iterator.cursor_set = true
|
41
|
+
selector.started = true
|
42
|
+
elsif segment.select_end == char.offset && selector.down? && started
|
43
|
+
iterator.cursor_position = [local_x + char.width, y, char.width, font_size.to_f]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
elsif !segment.select_end.nil? && segment.select_end < char.offset
|
47
|
+
selection&.started = false
|
48
|
+
end
|
49
|
+
hit_box = Hokusai::Rect.new(local_x, y, char.width, font_size.to_f)
|
50
|
+
iterator.on_char_cb&.call(char, hit_box, char.offset)
|
51
|
+
|
35
52
|
if selector = selection
|
36
|
-
if
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
53
|
+
if selector.active? && selector.selected(local_x, y, char.width.to_f, font_size.to_f)
|
54
|
+
self.stop_select = char.offset
|
55
|
+
|
56
|
+
unless started
|
57
|
+
self.start_select = char.offset
|
58
|
+
self.started = true
|
59
|
+
end
|
42
60
|
end
|
43
61
|
end
|
44
|
-
|
45
|
-
|
62
|
+
|
63
|
+
local_x += char.width
|
46
64
|
end
|
65
|
+
end
|
66
|
+
else
|
47
67
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
68
|
+
segment.chars.each do |char|
|
69
|
+
if can_render_inside(font_size, boundary) && segment.char_is_selected(char)
|
70
|
+
self.select_x ||= local_x
|
71
|
+
self.select_width = select_width.nil? ? char.width : (select_width + char.width)
|
72
|
+
|
73
|
+
if selector = selection
|
74
|
+
if segment.select_begin == char.offset && selector.up? && !iterator.cursor_set && !selector.started
|
75
|
+
iterator.cursor_position = [local_x, y, char.width, font_size.to_f]
|
76
|
+
iterator.cursor_set = true
|
77
|
+
selector.started = true
|
78
|
+
elsif segment.select_end == char.offset && selector.down? && started
|
79
|
+
iterator.cursor_position = [local_x + char.width, y, char.width, font_size.to_f]
|
80
|
+
end
|
81
|
+
end
|
82
|
+
elsif !segment.select_end.nil? && segment.select_end < char.offset
|
83
|
+
selection&.started = false
|
84
|
+
end
|
85
|
+
|
86
|
+
hit_box = Hokusai::Rect.new(local_x, y, char.width, font_size.to_f)
|
87
|
+
iterator.on_char_cb&.call(char, hit_box, char.offset)
|
54
88
|
|
55
|
-
|
56
|
-
|
57
|
-
|
89
|
+
if selector = selection
|
90
|
+
if selector.active? && selector.selected(local_x, y, char.width.to_f, font_size.to_f)
|
91
|
+
self.stop_select = char.offset
|
58
92
|
|
59
|
-
|
60
|
-
|
61
|
-
|
93
|
+
unless started
|
94
|
+
self.start_select = char.offset
|
95
|
+
self.started = true
|
96
|
+
end
|
62
97
|
end
|
63
98
|
end
|
99
|
+
|
100
|
+
local_x += char.width
|
64
101
|
end
|
65
102
|
|
66
|
-
|
103
|
+
# hit_box.x = local_x
|
104
|
+
# hit_box.y = y
|
105
|
+
# hit_box.width = char.width
|
106
|
+
# hit_box.height = font_size.to_f
|
107
|
+
|
108
|
+
|
67
109
|
end
|
68
110
|
|
69
111
|
return unless select_x && select_width
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hokusai-zero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- skinnyjames
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.16'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: colorize
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: concurrent-ruby
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +80,20 @@ dependencies:
|
|
94
80
|
- - ">="
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: mini_portile2
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
97
|
description:
|
98
98
|
email: zero@skinnyjames.net
|
99
99
|
executables: []
|
@@ -200,6 +200,7 @@ files:
|
|
200
200
|
- ui/spec/hokusai/directives_spec.rb
|
201
201
|
- ui/spec/hokusai/e2e/client_spec.rb
|
202
202
|
- ui/spec/hokusai/e2e/meta_spec.rb
|
203
|
+
- ui/spec/hokusai/providers_spec.rb
|
203
204
|
- ui/spec/hokusai/publisher_spec.rb
|
204
205
|
- ui/spec/hokusai/slots_spec.rb
|
205
206
|
- ui/spec/hokusai/util/piece_table_spec.rb
|
@@ -292,7 +293,7 @@ files:
|
|
292
293
|
- xmake.lua
|
293
294
|
homepage: https://codeberg.org/skinnyjames/hokusai
|
294
295
|
licenses:
|
295
|
-
-
|
296
|
+
- MIT
|
296
297
|
metadata:
|
297
298
|
source_code_uri: https://codeberg.org/skinnyjames/hokusai
|
298
299
|
post_install_message:
|