scarpe 0.4.0 → 0.5.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 (91) hide show
  1. checksums.yaml +4 -4
  2. data/.cursor/rules/commit-style-preferences.mdc +72 -0
  3. data/.cursor/rules/component_context.mdc +82 -0
  4. data/.cursor/rules/debug-failed-tests.mdc +100 -0
  5. data/.cursor/rules/display_service_context.mdc +80 -0
  6. data/.cursor/rules/event_handling_context.mdc +100 -0
  7. data/.cursor/rules/git-pager-handling.mdc +64 -0
  8. data/.cursor/rules/lacci-context.mdc +52 -0
  9. data/.cursor/rules/scarpe_design_context.mdc +46 -0
  10. data/.cursor/rules/shoes_compatibility_context.mdc +75 -0
  11. data/.cursor/rules/timeout_context.mdc +78 -0
  12. data/.cursor/rules/update_lacci_and_wv.mdc +8 -0
  13. data/.cursor/rules/what_is_scarpe.mdc +22 -0
  14. data/.cursor/rules/writing-new-rules.mdc +73 -0
  15. data/CHANGELOG.md +10 -1
  16. data/CLAUDE.md +223 -0
  17. data/Gemfile +0 -1
  18. data/Gemfile.lock +78 -58
  19. data/README.md +4 -7
  20. data/Rakefile +17 -25
  21. data/docs/SCARPE_FEATURES.md +38 -0
  22. data/docs/_config.yml +13 -0
  23. data/docs/calzini_components_and_updates.md +78 -0
  24. data/docs/display_service_separation.md +39 -0
  25. data/docs/documentation.md +43 -0
  26. data/docs/event_loops.md +66 -0
  27. data/docs/image.png +0 -0
  28. data/docs/index.md +118 -0
  29. data/docs/lacci.md +121 -0
  30. data/docs/scarpe_shoes_incompatibilities.md +71 -0
  31. data/docs/shoes_and_display_events.md +55 -0
  32. data/docs/shoes_implementations.md +79 -0
  33. data/docs/static/manual.md +5 -0
  34. data/docs/static/scarpe-logo.png +0 -0
  35. data/docs/timeouts_and_handlers.md +66 -0
  36. data/docs/web_archaeology.md +76 -0
  37. data/examples/background_with_image.rb +14 -5
  38. data/examples/bloopsaphone/working/feepogram.rb +1 -1
  39. data/examples/bloopsaphone/working/le_dance_des_rubis.rb +135 -0
  40. data/examples/bloopsaphone/working/pixel_dreams_in_ruby.rb +131 -0
  41. data/examples/bloopsaphone/working/type_rebellion.rb +157 -0
  42. data/examples/border.rb +1 -1
  43. data/examples/internal_link_navigation.rb +19 -0
  44. data/examples/page_navigation_single_app.rb +42 -0
  45. data/examples/shoes_subclass_app.rb +25 -0
  46. data/examples/url_routing_example.rb +67 -0
  47. data/lacci/Gemfile +0 -2
  48. data/lacci/Gemfile.lock +4 -32
  49. data/lacci/lacci.gemspec +1 -1
  50. data/lacci/lib/lacci/version.rb +1 -1
  51. data/lacci/lib/scarpe/niente/app.rb +12 -1
  52. data/lacci/lib/scarpe/niente/shoes_spec.rb +4 -5
  53. data/lacci/lib/scarpe/niente.rb +1 -0
  54. data/lacci/lib/shoes/app.rb +166 -61
  55. data/lacci/lib/shoes/constants.rb +1 -0
  56. data/lacci/lib/shoes/drawable.rb +35 -19
  57. data/lacci/lib/shoes/drawables/arc.rb +2 -2
  58. data/lacci/lib/shoes/drawables/arrow.rb +2 -2
  59. data/lacci/lib/shoes/drawables/border.rb +1 -1
  60. data/lacci/lib/shoes/drawables/button.rb +1 -1
  61. data/lacci/lib/shoes/drawables/edit_line.rb +1 -1
  62. data/lacci/lib/shoes/drawables/flow.rb +1 -1
  63. data/lacci/lib/shoes/drawables/line.rb +2 -2
  64. data/lacci/lib/shoes/drawables/link.rb +11 -1
  65. data/lacci/lib/shoes/drawables/oval.rb +2 -2
  66. data/lacci/lib/shoes/drawables/rect.rb +2 -2
  67. data/lacci/lib/shoes/drawables/shape.rb +2 -2
  68. data/lacci/lib/shoes/drawables/slot.rb +5 -3
  69. data/lacci/lib/shoes/drawables/stack.rb +1 -1
  70. data/lacci/lib/shoes/drawables/star.rb +1 -1
  71. data/lacci/lib/shoes/drawables/widget.rb +1 -1
  72. data/lacci/lib/shoes.rb +94 -17
  73. data/lacci/test/test_margin_helper.rb +1 -1
  74. data/lacci/test/test_niente_test_infra.rb +14 -0
  75. data/lacci/test/test_shoes_errors.rb +15 -13
  76. data/lib/scarpe/assets.rb +2 -1
  77. data/lib/scarpe/shoes_spec.rb +2 -1
  78. data/lib/scarpe/version.rb +1 -1
  79. data/lib/scarpe/wv/edit_line.rb +2 -2
  80. data/lib/scarpe/wv.rb +8 -1
  81. data/scarpe-components/Gemfile +0 -2
  82. data/scarpe-components/Gemfile.lock +4 -34
  83. data/scarpe-components/lib/scarpe/components/calzini/misc.rb +10 -2
  84. data/scarpe-components/lib/scarpe/components/calzini/para.rb +6 -1
  85. data/scarpe-components/lib/scarpe/components/calzini/slots.rb +2 -0
  86. data/scarpe-components/lib/scarpe/components/port_helpers.rb +30 -0
  87. data/scarpe-components/lib/scarpe/components/version.rb +1 -1
  88. data/scarpe-components/scarpe-components.gemspec +1 -1
  89. data/scarpe-components/test/test_port_helpers.rb +12 -0
  90. metadata +60 -22
  91. data/.rubocop.yml +0 -94
@@ -0,0 +1,157 @@
1
+ require_relative 'feepogram'
2
+
3
+ bloops = Bloops.new
4
+ bloops.tempo = 360 # Fast and furious!
5
+
6
+ song = Feepogram.new(bloops) do
7
+ # The mighty kick of rebellion
8
+ sound :boss_kick, Bloops::SQUARE do |s|
9
+ s.volume = 0.8
10
+ s.punch = 0.8
11
+ s.sustain = 0.2
12
+ s.decay = 0.1
13
+ s.phase = 0.2
14
+ end
15
+
16
+ # The snare of defiance
17
+ sound :battle_snare, Bloops::NOISE do |s|
18
+ s.volume = 0.7
19
+ s.punch = 0.6
20
+ s.sustain = 0.1
21
+ s.decay = 0.2
22
+ s.freq = 0.5
23
+ end
24
+
25
+ # The relentless type checker
26
+ sound :type_checker, Bloops::SAWTOOTH do |s|
27
+ s.volume = 0.6
28
+ s.punch = 0.4
29
+ s.sustain = 0.2
30
+ s.decay = 0.1
31
+ s.slide = -0.3 # Menacing downward slide
32
+ end
33
+
34
+ # The sword of dynamic typing
35
+ sound :ruby_sword, Bloops::SQUARE do |s|
36
+ s.volume = 0.6
37
+ s.punch = 0.5
38
+ s.sustain = 0.15
39
+ s.decay = 0.2
40
+ s.phase = 0.3
41
+ s.freq = 0.8
42
+ end
43
+
44
+ # Duck typing power-up
45
+ sound :duck_power, Bloops::SAWTOOTH do |s|
46
+ s.volume = 0.5
47
+ s.punch = 0.3
48
+ s.sustain = 0.4
49
+ s.decay = 0.2
50
+ s.slide = 0.2
51
+ end
52
+
53
+ # The battle cry
54
+ sound :battle_cry, Bloops::SQUARE do |s|
55
+ s.volume = 0.7
56
+ s.punch = 0.5
57
+ s.sustain = 0.3
58
+ s.decay = 0.2
59
+ s.phase = 0.4
60
+ end
61
+
62
+ def intense_beat
63
+ boss_kick " c 4 c 4 c c 4 c " * 4
64
+ battle_snare " 4 c 4 c 4 c c c " * 4
65
+ end
66
+
67
+ def type_checker_attack
68
+ type_checker %{
69
+ c4 c4 g3 g3 c4 c4 g3 g3
70
+ a3 a3 e3 e3 a3 a3 e3 e3
71
+ f3 f3 c3 c3 f3 f3 c3 c3
72
+ g3 g3 d3 d3 g3 g3 d3 d3
73
+ }
74
+ end
75
+
76
+ def ruby_counter_attack
77
+ ruby_sword %{
78
+ c5 g5 c6 g5 c5 g5 c6 g5
79
+ a5 e6 a6 e6 a5 e6 a6 e6
80
+ f5 c6 f6 c6 f5 c6 f6 c6
81
+ g5 d6 g6 d6 g5 d6 g6 d6
82
+ }
83
+ end
84
+
85
+ def duck_typing_combo
86
+ duck_power %{
87
+ 8:c6 8:d6 8:e6 8:f6 8:g6 8:a6 8:b6 c7
88
+ 8:c7 8:b6 8:a6 8:g6 8:f6 8:e6 8:d6 c6
89
+ 8:a5 8:b5 8:c6 8:d6 8:e6 8:f6 8:g6 a6
90
+ 8:a6 8:g6 8:f6 8:e6 8:d6 8:c6 8:b5 a5
91
+ }
92
+ end
93
+
94
+ def battle_cry_melody
95
+ battle_cry %{
96
+ c5 4 g5 4 c6 4 g5 c5
97
+ a5 4 e5 4 a5 4 e5 a4
98
+ f5 4 c6 4 f6 4 c6 f5
99
+ g5 4 d6 4 g6 4 d6 g5
100
+ }
101
+ end
102
+
103
+ def intro_phase
104
+ 2.times do
105
+ phrase do
106
+ intense_beat
107
+ type_checker_attack
108
+ end
109
+ end
110
+ end
111
+
112
+ def battle_phase
113
+ 2.times do
114
+ phrase do
115
+ intense_beat
116
+ type_checker_attack
117
+ ruby_counter_attack
118
+ end
119
+ end
120
+ end
121
+
122
+ def power_up_phase
123
+ phrase do
124
+ intense_beat
125
+ duck_typing_combo
126
+ battle_cry_melody
127
+ end
128
+ end
129
+
130
+ def final_stand
131
+ phrase do
132
+ intense_beat
133
+ type_checker_attack
134
+ ruby_counter_attack
135
+ duck_typing_combo
136
+ battle_cry_melody
137
+ end
138
+ end
139
+
140
+ def victory_outro
141
+ phrase do
142
+ boss_kick " c 4 4 4 "
143
+ ruby_sword " c6 e6 g6 c7 "
144
+ battle_cry " 1:c6 "
145
+ end
146
+ end
147
+
148
+ # The epic battle unfolds!
149
+ intro_phase
150
+ battle_phase
151
+ power_up_phase
152
+ battle_phase
153
+ final_stand
154
+ victory_outro
155
+ end
156
+
157
+ song.play
data/examples/border.rb CHANGED
@@ -8,4 +8,4 @@ Shoes.app(width: 300, height: 50) do
8
8
  para "This border is also on top of text"
9
9
  border blue, strokewidth: 4
10
10
  end
11
- end
11
+ end
@@ -0,0 +1,19 @@
1
+ # Test for internal link navigation (issue #569)
2
+ # link(click: "/path") should trigger visit() internally
3
+
4
+ Shoes.app width: 400, height: 300, title: "Internal Link Test" do
5
+ page(:index) do
6
+ title "Page 1"
7
+ para "This is the first page."
8
+ para link("Go to Page 2", click: "/page2")
9
+ end
10
+
11
+ page(:page2) do
12
+ title "Page 2"
13
+ para "You navigated here internally!"
14
+ para link("Back to Page 1", click: "/index")
15
+ end
16
+
17
+ # Start on the index page
18
+ visit(:index)
19
+ end
@@ -0,0 +1,42 @@
1
+ Shoes.app(title: "Page Navigation Example", width: 300, height: 200) do
2
+ style(Shoes::Para, size: 10)
3
+ style(Shoes::Button, width: 80)
4
+
5
+ page(:home) do
6
+ title "Home Page"
7
+ background "#f0f0f0"
8
+ para "Welcome to the page navigation example!"
9
+ button "Go to Razzmatazz" do
10
+ visit(:razzmatazz)
11
+ end
12
+ button "Go to FlooperLand" do
13
+ visit(:flooperland)
14
+ end
15
+ end
16
+
17
+ page(:razzmatazz) do
18
+ title "Razzmatazz"
19
+ background "#DFA5A5"
20
+ para "This is Razzmatazz"
21
+ button "Go Home" do
22
+ visit(:home)
23
+ end
24
+ button "Go to FlooperLand" do
25
+ visit(:flooperland)
26
+ end
27
+ end
28
+
29
+ page(:flooperland) do
30
+ title "FlooperLand"
31
+ background "#A5DFA5"
32
+ para "This is FlooperLand"
33
+ button "Go Home" do
34
+ visit(:home)
35
+ end
36
+ button "Go to Razzmatazz" do
37
+ visit(:razzmatazz)
38
+ end
39
+ end
40
+
41
+ visit(:home) # Start at the home page
42
+ end
@@ -0,0 +1,25 @@
1
+ # Test for class MyApp < Shoes inheritance pattern
2
+ # This is the classic Shoes pattern that _why designed
3
+
4
+ class MyBook < Shoes
5
+ url '/', :index
6
+ url '/about', :about
7
+
8
+ def index
9
+ stack margin: 20 do
10
+ title "Welcome to My Book"
11
+ para "This is the index page using the classic Shoes inheritance pattern!"
12
+ para link("Go to About", click: "/about")
13
+ end
14
+ end
15
+
16
+ def about
17
+ stack margin: 20 do
18
+ title "About"
19
+ para "This page shows that URL routing works with class inheritance!"
20
+ para link("Back to Index", click: "/")
21
+ end
22
+ end
23
+ end
24
+
25
+ Shoes.app width: 400, height: 300, title: "Shoes Subclass Test"
@@ -0,0 +1,67 @@
1
+ Shoes.app(title: 'Advanced URL Routing Example', width: 300, height: 200) do
2
+ style(Shoes::Para, size: 10)
3
+ style(Shoes::Button, width: 80)
4
+
5
+ url '/', :index
6
+ url '/about', :about
7
+ url '/contact', :contact
8
+ url '/user/(\d+)', :user
9
+ url '/product/(\w+)', :product
10
+
11
+ def index
12
+ background '#f0f0f0'
13
+ title 'Home Page'
14
+ para 'Welcome to the advanced URL routing example!'
15
+ button 'About' do
16
+ visit '/about'
17
+ end
18
+ button 'Contact' do
19
+ visit '/contact'
20
+ end
21
+ button 'User 42' do
22
+ visit '/user/42'
23
+ end
24
+ @user_id = edit_line(1, width: "40%", secret: true)
25
+ button 'Pick a user' do
26
+ visit "/user/#{@user_id.text}"
27
+ end
28
+ button 'Product XYZ' do
29
+ visit '/product/XYZ'
30
+ end
31
+ end
32
+
33
+ def about
34
+ background '#DFA5A5'
35
+ title 'About Page'
36
+ para 'This is the About page.'
37
+ home_button
38
+ end
39
+
40
+ def contact
41
+ background '#A5DFA5'
42
+ title 'Contact Page'
43
+ para 'This is the Contact page.'
44
+ home_button
45
+ end
46
+
47
+ def user(id)
48
+ background '#A5A5DF'
49
+ title 'User Page'
50
+ para "EDIT LINE: #{@user_id&.text}"
51
+ para "This is the page for User #{id}"
52
+ home_button
53
+ end
54
+
55
+ def product(name)
56
+ background '#DFDF A5'
57
+ title 'Product Page'
58
+ para "This is the page for Product #{name}"
59
+ home_button
60
+ end
61
+
62
+ def home_button
63
+ button 'Home' do
64
+ visit '/'
65
+ end
66
+ end
67
+ end
data/lacci/Gemfile CHANGED
@@ -17,8 +17,6 @@ group :development do
17
17
  gem "yard"
18
18
  gem "redcarpet"
19
19
  gem "debug"
20
- gem "rubocop", "~> 1.21"
21
- gem "rubocop-shopify"
22
20
  #gem "commonmarker"
23
21
  #gem "github-markup"
24
22
  end
data/lacci/Gemfile.lock CHANGED
@@ -1,19 +1,18 @@
1
1
  PATH
2
2
  remote: ../scarpe-components
3
3
  specs:
4
- scarpe-components (0.3.0)
4
+ scarpe-components (0.4.0)
5
5
 
6
6
  PATH
7
7
  remote: .
8
8
  specs:
9
- lacci (0.3.0)
10
- scarpe-components
9
+ lacci (0.4.0)
10
+ scarpe-components (~> 0.4.0)
11
11
 
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
15
  ansi (1.5.0)
16
- ast (2.4.2)
17
16
  builder (3.2.4)
18
17
  debug (1.8.0)
19
18
  irb (>= 1.5.0)
@@ -21,46 +20,21 @@ GEM
21
20
  io-console (0.6.0)
22
21
  irb (1.7.2)
23
22
  reline (>= 0.3.6)
24
- json (2.6.3)
25
- language_server-protocol (3.17.0.3)
26
23
  minitest (5.18.1)
27
24
  minitest-reporters (1.6.0)
28
25
  ansi
29
26
  builder
30
27
  minitest (>= 5.0)
31
28
  ruby-progressbar
32
- parallel (1.23.0)
33
- parser (3.2.2.3)
34
- ast (~> 2.4.1)
35
- racc
36
- racc (1.7.1)
37
- rainbow (3.1.1)
38
29
  rake (13.0.6)
39
30
  redcarpet (3.6.0)
40
- regexp_parser (2.8.1)
41
31
  reline (0.3.6)
42
32
  io-console (~> 0.5)
43
- rexml (3.2.5)
44
- rubocop (1.54.1)
45
- json (~> 2.3)
46
- language_server-protocol (>= 3.17.0)
47
- parallel (~> 1.10)
48
- parser (>= 3.2.2.3)
49
- rainbow (>= 2.2.2, < 4.0)
50
- regexp_parser (>= 1.8, < 3.0)
51
- rexml (>= 3.2.5, < 4.0)
52
- rubocop-ast (>= 1.28.0, < 2.0)
53
- ruby-progressbar (~> 1.7)
54
- unicode-display_width (>= 2.4.0, < 3.0)
55
- rubocop-ast (1.29.0)
56
- parser (>= 3.2.1.0)
57
- rubocop-shopify (2.14.0)
58
- rubocop (~> 1.51)
59
33
  ruby-progressbar (1.13.0)
60
- unicode-display_width (2.4.2)
61
34
  yard (0.9.34)
62
35
 
63
36
  PLATFORMS
37
+ arm64-darwin-21
64
38
  x86_64-darwin-22
65
39
 
66
40
  DEPENDENCIES
@@ -70,8 +44,6 @@ DEPENDENCIES
70
44
  minitest-reporters
71
45
  rake (~> 13.0)
72
46
  redcarpet
73
- rubocop (~> 1.21)
74
- rubocop-shopify
75
47
  scarpe-components!
76
48
  yard
77
49
 
data/lacci/lacci.gemspec CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
  # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
17
17
 
18
18
  spec.metadata["homepage_uri"] = spec.homepage
19
- spec.metadata["source_code_uri"] = "https://github.com/scarpe-team/scarpe"
19
+ #spec.metadata["source_code_uri"] = "https://github.com/scarpe-team/scarpe"
20
20
  spec.metadata["changelog_uri"] = "https://github.com/scarpe-team/scarpe/blob/main/CHANGELOG.md"
21
21
 
22
22
  # Specify which files should be added to the gem when it is released.
@@ -9,5 +9,5 @@
9
9
  # mostly invisible. Instead, look at the {Shoes} module
10
10
  # to see what's in Lacci.
11
11
  module Lacci
12
- VERSION = "0.4.0"
12
+ VERSION = "0.5.0"
13
13
  end
@@ -14,7 +14,18 @@ module Niente
14
14
  end
15
15
 
16
16
  def run
17
- send_shoes_event("wait", event_name: "custom_event_loop")
17
+ send_shoes_event("return", event_name: "custom_event_loop")
18
+
19
+ @do_shutdown = false
20
+ bind_shoes_event(event_name: "destroy") do
21
+ @do_shutdown = true
22
+ end
23
+
24
+ at_exit do
25
+ until @do_shutdown
26
+ Shoes::DisplayService.dispatch_event("heartbeat", nil)
27
+ end
28
+ end
18
29
  end
19
30
 
20
31
  def destroy
@@ -8,7 +8,7 @@ module Niente; end
8
8
  class Niente::Test
9
9
  def self.run_shoes_spec_test_code(code, class_name: nil, test_name: nil)
10
10
  if @shoes_spec_init
11
- raise Shoes::Errors::MultipleShoesSpecRunsError, "Scarpe-Webview can only run a single Shoes spec per process!"
11
+ raise Shoes::Errors::MultipleShoesSpecRunsError, "Niente can only run a single Shoes spec per process!"
12
12
  end
13
13
  @shoes_spec_init = true
14
14
 
@@ -21,7 +21,7 @@ class Niente::Test
21
21
  Shoes::DisplayService.subscribe_to_event("heartbeat", nil) do
22
22
  unless @hb_init
23
23
  Minitest.run []
24
- Shoes::App.instance.destroy
24
+ Shoes.APPS.each(&:destroy)
25
25
  end
26
26
  @hb_init = true
27
27
  end
@@ -40,9 +40,8 @@ class Niente::ShoesSpecTest < Minitest::Test
40
40
  finder_name = drawable_class.dsl_name
41
41
 
42
42
  define_method(finder_name) do |*args|
43
- app = Shoes::App.instance
43
+ drawables = Shoes::App.find_drawables_by(drawable_class, *args)
44
44
 
45
- drawables = app.find_drawables_by(drawable_class, *args)
46
45
  raise Shoes::Errors::MultipleDrawablesFoundError, "Found more than one #{finder_name} matching #{args.inspect}!" if drawables.size > 1
47
46
  raise Shoes::Errors::NoDrawablesFoundError, "Found no #{finder_name} matching #{args.inspect}!" if drawables.empty?
48
47
 
@@ -51,7 +50,7 @@ class Niente::ShoesSpecTest < Minitest::Test
51
50
  end
52
51
 
53
52
  def drawable(*specs)
54
- drawables = Shoes::App.instance.find_drawables_by(*specs)
53
+ drawables = Shoes::App.find_drawables_by(*specs)
55
54
  raise Shoes::Errors::MultipleDrawablesFoundError, "Found more than one #{finder_name} matching #{args.inspect}!" if drawables.size > 1
56
55
  raise Shoes::Errors::NoDrawablesFoundError, "Found no #{finder_name} matching #{args.inspect}!" if drawables.empty?
57
56
  Niente::ShoesSpecProxy.new(drawables[0])
@@ -30,3 +30,4 @@ Shoes.add_file_loader loader
30
30
 
31
31
  Shoes::DisplayService.set_display_service_class(Niente::DisplayService)
32
32
 
33
+ Shoes::FEATURES.push(:multi_app)