scarpe 0.3.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 (297) 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 +46 -5
  16. data/CLAUDE.md +223 -0
  17. data/Gemfile +2 -2
  18. data/Gemfile.lock +85 -55
  19. data/LICENSE.txt +7 -1
  20. data/README.md +80 -20
  21. data/Rakefile +73 -14
  22. data/docs/SCARPE_FEATURES.md +38 -0
  23. data/docs/_config.yml +13 -0
  24. data/docs/calzini_components_and_updates.md +78 -0
  25. data/docs/display_service_separation.md +39 -0
  26. data/docs/documentation.md +43 -0
  27. data/docs/event_loops.md +66 -0
  28. data/docs/image.png +0 -0
  29. data/docs/index.md +118 -0
  30. data/docs/lacci.md +121 -0
  31. data/docs/scarpe_shoes_incompatibilities.md +71 -0
  32. data/docs/shoes_and_display_events.md +55 -0
  33. data/docs/shoes_implementations.md +79 -0
  34. data/docs/static/manual.md +5 -0
  35. data/docs/static/scarpe-logo.png +0 -0
  36. data/docs/timeouts_and_handlers.md +66 -0
  37. data/docs/web_archaeology.md +76 -0
  38. data/examples/Edit_box_Styles.rb +8 -0
  39. data/examples/Kerning.rb +7 -0
  40. data/examples/background_with_image.rb +14 -5
  41. data/examples/bloopsaphone/working/feepogram.rb +1 -1
  42. data/examples/bloopsaphone/working/le_dance_des_rubis.rb +135 -0
  43. data/examples/bloopsaphone/working/pixel_dreams_in_ruby.rb +131 -0
  44. data/examples/bloopsaphone/working/type_rebellion.rb +157 -0
  45. data/examples/border.rb +11 -0
  46. data/examples/check.rb +2 -0
  47. data/examples/download_and_show_image.rb +3 -0
  48. data/examples/flags/finland.rb +15 -0
  49. data/examples/flags/italy.rb +11 -0
  50. data/examples/flags/mauritius.rb +14 -0
  51. data/examples/font_family.rb +17 -0
  52. data/examples/font_shorthand.rb +9 -0
  53. data/examples/gen.rb +4 -0
  54. data/examples/internal_link_navigation.rb +19 -0
  55. data/examples/legacy/not_checked/shoes-manual/append.rb +10 -0
  56. data/examples/legacy/not_checked/shoes-manual/background_change.rb +12 -0
  57. data/examples/legacy/not_checked/shoes-manual/background_pattern.rb +5 -0
  58. data/examples/legacy/not_checked/shoes-manual/basic_app.rb +8 -0
  59. data/examples/legacy/not_checked/shoes-manual/border.rb +9 -0
  60. data/examples/legacy/not_checked/shoes-manual/builtins/FONTS.rb +5 -0
  61. data/examples/legacy/not_checked/shoes-manual/builtins/ask.rb +2 -0
  62. data/examples/legacy/not_checked/shoes-manual/builtins/ask_color.rb +5 -0
  63. data/examples/legacy/not_checked/shoes-manual/builtins/ask_open_file.rb +5 -0
  64. data/examples/legacy/not_checked/shoes-manual/builtins/ask_save_folder.rb +2 -0
  65. data/examples/legacy/not_checked/shoes-manual/builtins/confirm.rb +4 -0
  66. data/examples/legacy/not_checked/shoes-manual/builtins/debug.rb +2 -0
  67. data/examples/legacy/not_checked/shoes-manual/builtins/info.rb +3 -0
  68. data/examples/legacy/not_checked/shoes-manual/button.rb +9 -0
  69. data/examples/legacy/not_checked/shoes-manual/clear.rb +7 -0
  70. data/examples/legacy/not_checked/shoes-manual/custom_header.rb +13 -0
  71. data/examples/legacy/not_checked/shoes-manual/displace.rb +14 -0
  72. data/examples/legacy/not_checked/shoes-manual/edit_box.rb +8 -0
  73. data/examples/legacy/not_checked/shoes-manual/fill_pattern.rb +5 -0
  74. data/examples/legacy/not_checked/shoes-manual/fonts.rb +7 -0
  75. data/examples/legacy/not_checked/shoes-manual/gutter.rb +6 -0
  76. data/examples/legacy/not_checked/shoes-manual/image_web.rb +4 -0
  77. data/examples/legacy/not_checked/shoes-manual/keypress.rb +7 -0
  78. data/examples/legacy/not_checked/shoes-manual/list_box.rb +10 -0
  79. data/examples/legacy/not_checked/shoes-manual/motion.rb +10 -0
  80. data/examples/legacy/not_checked/shoes-manual/mouse.rb +8 -0
  81. data/examples/legacy/not_checked/shoes-manual/move.rb +14 -0
  82. data/examples/legacy/not_checked/shoes-manual/nested_ovals.rb +8 -0
  83. data/examples/legacy/not_checked/shoes-manual/oval.rb +7 -0
  84. data/examples/legacy/not_checked/shoes-manual/ovals.rb +6 -0
  85. data/examples/legacy/not_checked/shoes-manual/ovals_image.rb +8 -0
  86. data/examples/legacy/not_checked/shoes-manual/prepend.rb +7 -0
  87. data/examples/legacy/not_checked/shoes-manual/progress_bar.rb +10 -0
  88. data/examples/legacy/not_checked/shoes-manual/radio.rb +18 -0
  89. data/examples/legacy/not_checked/shoes-manual/radio_alternative_1.rb +7 -0
  90. data/examples/legacy/not_checked/shoes-manual/radio_alternative_2.rb +9 -0
  91. data/examples/legacy/not_checked/shoes-manual/rotate_rectangle.rb +6 -0
  92. data/examples/legacy/not_checked/shoes-manual/shape.rb +11 -0
  93. data/examples/legacy/not_checked/shoes-manual/static/avatar.png +0 -0
  94. data/examples/legacy/not_checked/shoes-manual/stroke.rb +5 -0
  95. data/examples/legacy/not_checked/shoes-manual/style.rb +3 -0
  96. data/examples/legacy/not_checked/shoes-manual/style_alternative_1.rb +4 -0
  97. data/examples/legacy/not_checked/shoes-manual/style_alternative_2.rb +5 -0
  98. data/examples/legacy/not_checked/shoes-manual/style_length.rb +5 -0
  99. data/examples/legacy/not_checked/shoes-manual/timer.rb +6 -0
  100. data/examples/legacy/not_checked/shoes-manual/trigger_window.rb +8 -0
  101. data/examples/legacy/not_checked/shoes-manual/window_owner.rb +8 -0
  102. data/examples/legacy/working/shoes_manual/alert_button.rb +2 -0
  103. data/examples/legacy/working/shoes_manual/animate.rb +7 -0
  104. data/examples/legacy/working/shoes_manual/background_para.rb +4 -0
  105. data/examples/legacy/working/shoes_manual/button_alternative.rb +7 -0
  106. data/examples/legacy/working/shoes_manual/checkbox.rb +17 -0
  107. data/examples/legacy/working/shoes_manual/download.rb +12 -0
  108. data/examples/legacy/working/shoes_manual/edit_box.rb +6 -0
  109. data/examples/legacy/working/shoes_manual/editline.rb +7 -0
  110. data/examples/legacy/working/shoes_manual/fixed_height.rb +8 -0
  111. data/examples/legacy/working/shoes_manual/fixed_width.rb +12 -0
  112. data/examples/legacy/working/shoes_manual/image.rb +5 -0
  113. data/examples/legacy/working/shoes_manual/instance_variable_check.rb +10 -0
  114. data/examples/legacy/working/shoes_manual/message.rb +18 -0
  115. data/examples/legacy/working/shoes_manual/rectangle.rb +6 -0
  116. data/examples/legacy/working/shoes_manual/save_download.rb +12 -0
  117. data/examples/legacy/working/shoes_manual/self_check.rb +10 -0
  118. data/examples/legacy/working/shoes_manual/stack.rb +7 -0
  119. data/examples/legacy/working/shoes_manual/style_info.rb +8 -0
  120. data/examples/legacy/working/shoes_manual/utf8_support.rb +8 -0
  121. data/examples/legacy/working/shoes_manual/width.rb +4 -0
  122. data/examples/local_assets/multi_image.rb +5 -0
  123. data/examples/local_assets/small.png +0 -0
  124. data/examples/local_fonts.rb +3 -0
  125. data/examples/margin.rb +13 -0
  126. data/examples/margin_check.rb +27 -0
  127. data/examples/oval-with-kwargs.rb +3 -0
  128. data/examples/oval.rb +26 -0
  129. data/examples/page_navigation_single_app.rb +42 -0
  130. data/examples/para_font_styles.rb +17 -0
  131. data/examples/para_font_variant.rb +6 -0
  132. data/examples/para_fontweight.rb +13 -0
  133. data/examples/parse_xl_funnies.rb +3 -0
  134. data/examples/rect.rb +1 -1
  135. data/examples/scarpe_ext.rb +3 -0
  136. data/examples/shapes/star.rb +1 -3
  137. data/examples/shoes_subclass_app.rb +25 -0
  138. data/examples/spacing.rb +1 -1
  139. data/examples/span.rb +4 -2
  140. data/examples/url_routing_example.rb +67 -0
  141. data/lacci/Gemfile +0 -2
  142. data/lacci/Gemfile.lock +4 -32
  143. data/lacci/lacci.gemspec +3 -3
  144. data/lacci/lib/lacci/scarpe_cli.rb +0 -1
  145. data/lacci/lib/lacci/version.rb +1 -1
  146. data/lacci/lib/scarpe/niente/app.rb +12 -1
  147. data/lacci/lib/scarpe/niente/display_service.rb +5 -1
  148. data/lacci/lib/scarpe/niente/drawable.rb +2 -0
  149. data/lacci/lib/scarpe/niente/shoes_spec.rb +10 -5
  150. data/lacci/lib/scarpe/niente.rb +15 -2
  151. data/lacci/lib/shoes/app.rb +204 -105
  152. data/lacci/lib/shoes/constants.rb +24 -2
  153. data/lacci/lib/shoes/display_service.rb +43 -4
  154. data/lacci/lib/shoes/drawable.rb +326 -36
  155. data/lacci/lib/shoes/drawables/arc.rb +4 -26
  156. data/lacci/lib/shoes/drawables/arrow.rb +3 -23
  157. data/lacci/lib/shoes/drawables/border.rb +28 -0
  158. data/lacci/lib/shoes/drawables/button.rb +5 -21
  159. data/lacci/lib/shoes/drawables/check.rb +7 -3
  160. data/lacci/lib/shoes/drawables/document_root.rb +4 -4
  161. data/lacci/lib/shoes/drawables/edit_box.rb +6 -5
  162. data/lacci/lib/shoes/drawables/edit_line.rb +5 -4
  163. data/lacci/lib/shoes/drawables/flow.rb +4 -6
  164. data/lacci/lib/shoes/drawables/font_helper.rb +62 -0
  165. data/lacci/lib/shoes/drawables/image.rb +2 -2
  166. data/lacci/lib/shoes/drawables/line.rb +3 -6
  167. data/lacci/lib/shoes/drawables/link.rb +16 -9
  168. data/lacci/lib/shoes/drawables/list_box.rb +8 -5
  169. data/lacci/lib/shoes/drawables/oval.rb +48 -0
  170. data/lacci/lib/shoes/drawables/para.rb +106 -18
  171. data/lacci/lib/shoes/drawables/progress.rb +2 -1
  172. data/lacci/lib/shoes/drawables/radio.rb +5 -3
  173. data/lacci/lib/shoes/drawables/rect.rb +7 -6
  174. data/lacci/lib/shoes/drawables/shape.rb +4 -3
  175. data/lacci/lib/shoes/drawables/slot.rb +102 -9
  176. data/lacci/lib/shoes/drawables/stack.rb +7 -12
  177. data/lacci/lib/shoes/drawables/star.rb +9 -31
  178. data/lacci/lib/shoes/drawables/text_drawable.rb +93 -34
  179. data/lacci/lib/shoes/drawables/video.rb +3 -2
  180. data/lacci/lib/shoes/drawables/widget.rb +9 -4
  181. data/lacci/lib/shoes/drawables.rb +2 -1
  182. data/lacci/lib/shoes/errors.rb +13 -3
  183. data/lacci/lib/shoes/margin_helper.rb +79 -0
  184. data/lacci/lib/shoes.rb +98 -20
  185. data/lacci/test/.gitignore +1 -0
  186. data/lacci/test/test_draw_context.rb +167 -0
  187. data/lacci/test/test_font_helper.rb +57 -0
  188. data/lacci/test/test_helper.rb +31 -4
  189. data/lacci/test/test_lacci.rb +93 -6
  190. data/lacci/test/test_margin_helper.rb +82 -0
  191. data/lacci/test/test_niente_test_infra.rb +40 -0
  192. data/lacci/test/test_oval.rb +82 -0
  193. data/lacci/test/test_parenting.rb +140 -0
  194. data/lacci/test/test_shoes_errors.rb +15 -13
  195. data/lacci/test/test_text_drawables.rb +23 -0
  196. data/lib/scarpe/assets.rb +19 -0
  197. data/lib/scarpe/cats_cradle.rb +57 -98
  198. data/lib/scarpe/shoes_spec.rb +24 -44
  199. data/lib/scarpe/version.rb +1 -1
  200. data/lib/scarpe/wv/app.rb +1 -0
  201. data/lib/scarpe/wv/arc.rb +0 -4
  202. data/lib/scarpe/wv/border.rb +15 -0
  203. data/lib/scarpe/wv/control_interface.rb +2 -10
  204. data/lib/scarpe/wv/document_root.rb +2 -2
  205. data/lib/scarpe/wv/drawable.rb +6 -40
  206. data/lib/scarpe/wv/edit_box.rb +4 -1
  207. data/lib/scarpe/wv/edit_line.rb +4 -1
  208. data/lib/scarpe/wv/image.rb +2 -5
  209. data/lib/scarpe/wv/link.rb +4 -2
  210. data/lib/scarpe/wv/oval.rb +13 -0
  211. data/lib/scarpe/wv/para.rb +1 -0
  212. data/lib/scarpe/wv/scarpe_extensions.rb +8 -0
  213. data/lib/scarpe/wv/shape.rb +10 -5
  214. data/lib/scarpe/wv/text_drawable.rb +72 -14
  215. data/lib/scarpe/wv/web_wrangler.rb +33 -11
  216. data/lib/scarpe/wv/webview_local_display.rb +6 -2
  217. data/lib/scarpe/wv.rb +16 -2
  218. data/scarpe-components/Gemfile +4 -3
  219. data/scarpe-components/Gemfile.lock +6 -37
  220. data/scarpe-components/README.md +2 -2
  221. data/scarpe-components/assets/bootstrap-themes/bootstrap-cerulean.css +12229 -0
  222. data/scarpe-components/assets/bootstrap-themes/bootstrap-cosmo.css +11810 -0
  223. data/scarpe-components/assets/bootstrap-themes/bootstrap-cyborg.css +12210 -0
  224. data/scarpe-components/assets/bootstrap-themes/bootstrap-darkly.css +12153 -0
  225. data/scarpe-components/assets/bootstrap-themes/bootstrap-flatly.css +12126 -0
  226. data/scarpe-components/assets/bootstrap-themes/bootstrap-icons.min.css +5 -0
  227. data/scarpe-components/assets/bootstrap-themes/bootstrap-journal.css +12099 -0
  228. data/scarpe-components/assets/bootstrap-themes/bootstrap-litera.css +12211 -0
  229. data/scarpe-components/assets/bootstrap-themes/bootstrap-lumen.css +12369 -0
  230. data/scarpe-components/assets/bootstrap-themes/bootstrap-lux.css +11928 -0
  231. data/scarpe-components/assets/bootstrap-themes/bootstrap-materia.css +13184 -0
  232. data/scarpe-components/assets/bootstrap-themes/bootstrap-minty.css +12177 -0
  233. data/scarpe-components/assets/bootstrap-themes/bootstrap-morph.css +12750 -0
  234. data/scarpe-components/assets/bootstrap-themes/bootstrap-pulse.css +11890 -0
  235. data/scarpe-components/assets/bootstrap-themes/bootstrap-quartz.css +12622 -0
  236. data/scarpe-components/assets/bootstrap-themes/bootstrap-sandstone.css +12201 -0
  237. data/scarpe-components/assets/bootstrap-themes/bootstrap-simplex.css +12186 -0
  238. data/scarpe-components/assets/bootstrap-themes/bootstrap-sketchy.css +12451 -0
  239. data/scarpe-components/assets/bootstrap-themes/bootstrap-slate.css +12492 -0
  240. data/scarpe-components/assets/bootstrap-themes/bootstrap-solar.css +12149 -0
  241. data/scarpe-components/assets/bootstrap-themes/bootstrap-spacelab.css +12266 -0
  242. data/scarpe-components/assets/bootstrap-themes/bootstrap-superhero.css +12216 -0
  243. data/scarpe-components/assets/bootstrap-themes/bootstrap-united.css +12077 -0
  244. data/scarpe-components/assets/bootstrap-themes/bootstrap-vapor.css +12549 -0
  245. data/scarpe-components/assets/bootstrap-themes/bootstrap-yeti.css +12325 -0
  246. data/scarpe-components/assets/bootstrap-themes/bootstrap-zephyr.css +12283 -0
  247. data/scarpe-components/assets/bootstrap-themes/bootstrap.bundle.min.js +7 -0
  248. data/scarpe-components/lib/scarpe/components/asset_server.rb +219 -0
  249. data/scarpe-components/lib/scarpe/components/base64.rb +22 -0
  250. data/scarpe-components/lib/scarpe/components/calzini/{art_widgets.rb → art_drawables.rb} +42 -18
  251. data/scarpe-components/lib/scarpe/components/calzini/border.rb +38 -0
  252. data/scarpe-components/lib/scarpe/components/calzini/button.rb +6 -8
  253. data/scarpe-components/lib/scarpe/components/calzini/misc.rb +14 -16
  254. data/scarpe-components/lib/scarpe/components/calzini/para.rb +218 -11
  255. data/scarpe-components/lib/scarpe/components/calzini/slots.rb +16 -60
  256. data/scarpe-components/lib/scarpe/components/calzini.rb +88 -1
  257. data/scarpe-components/lib/scarpe/components/errors.rb +4 -0
  258. data/scarpe-components/lib/scarpe/components/html.rb +4 -1
  259. data/scarpe-components/lib/scarpe/components/minitest_export_reporter.rb +11 -3
  260. data/scarpe-components/lib/scarpe/components/minitest_result.rb +41 -0
  261. data/scarpe-components/lib/scarpe/components/port_helpers.rb +30 -0
  262. data/scarpe-components/lib/scarpe/components/print_logger.rb +17 -2
  263. data/scarpe-components/lib/scarpe/components/process_helpers.rb +37 -0
  264. data/scarpe-components/lib/scarpe/components/segmented_file_loader.rb +1 -1
  265. data/scarpe-components/lib/scarpe/components/tiranti.rb +42 -100
  266. data/scarpe-components/lib/scarpe/components/unit_test_helpers.rb +3 -1
  267. data/scarpe-components/lib/scarpe/components/version.rb +1 -1
  268. data/scarpe-components/scarpe-components.gemspec +1 -1
  269. data/scarpe-components/test/assets/big-image.png +0 -0
  270. data/scarpe-components/test/assets/big-stylesheet.css +497 -0
  271. data/scarpe-components/test/assets/little-image.png +0 -0
  272. data/scarpe-components/test/assets/little-stylesheet.css +1 -0
  273. data/scarpe-components/test/calzini/test_calzini_art_drawables.rb +7 -7
  274. data/scarpe-components/test/calzini/test_calzini_button.rb +7 -5
  275. data/scarpe-components/test/calzini/test_calzini_misc.rb +9 -9
  276. data/scarpe-components/test/calzini/test_calzini_para.rb +6 -9
  277. data/scarpe-components/test/calzini/test_calzini_slots.rb +12 -57
  278. data/scarpe-components/test/calzini/test_calzini_text_drawables.rb +83 -18
  279. data/scarpe-components/test/calzini/test_various.rb +133 -0
  280. data/scarpe-components/test/test_asset_server.rb +72 -0
  281. data/scarpe-components/test/test_components.rb +31 -2
  282. data/scarpe-components/test/test_helper.rb +0 -1
  283. data/scarpe-components/test/test_minitest_result.rb +7 -0
  284. data/scarpe-components/test/test_port_helpers.rb +12 -0
  285. data/scarpe-components/test/test_segmented_app_files.rb +2 -0
  286. data/tasks/check_html_fixtures.rb +140 -0
  287. data/tasks/regenerate_html_fixtures.rb +104 -0
  288. data/templates/class_template_with_shapes.erb +0 -11
  289. metadata +225 -39
  290. data/.rubocop.yml +0 -88
  291. data/lacci/lib/scarpe/niente/logger.rb +0 -29
  292. data/lacci/lib/shoes/drawables/span.rb +0 -27
  293. data/lacci/lib/shoes/spacing.rb +0 -9
  294. data/lib/scarpe/evented_assertions.rb +0 -121
  295. data/lib/scarpe/wv/span.rb +0 -44
  296. data/scarpe-components/lib/scarpe/components/calzini/text_widgets.rb +0 -65
  297. /data/examples/legacy/{not_checked → working}/shoes3-tests/editline/editline.rb +0 -0
@@ -26,38 +26,26 @@ module Scarpe::Test
26
26
  class_name ||= ENV["SHOES_MINITEST_CLASS_NAME"] || "TestShoesSpecCode"
27
27
  test_name ||= ENV["SHOES_MINITEST_METHOD_NAME"] || "test_shoes_spec"
28
28
 
29
- require_relative "cats_cradle"
30
-
31
- # We want Minitest assertions available in the test code.
32
- # But this will normally run in a subprocess. So we need
33
- # to run Minitest tests and then export the results.
34
-
35
- # We create a test object based on CatsCradle, which will
36
- # run the test as straight-line code, wait for appropriate
37
- # events and generally make things well-behaved. But the
38
- # test DSL isn't CatsCradle. It's based on Minitest and
39
- # ShoesSpecTest (see below).
40
- #
41
- # Note that that means that using CatsCradle to "bounce"
42
- # control back and forth for evented tricks isn't really
43
- # an option. We may need to revisit all of this later...
44
- test_obj = Object.new
45
- class << test_obj
46
- include Scarpe::Test::CatsCradle
47
- end
48
- Scarpe::ShoesSpecTest.test_obj = test_obj
49
- test_obj.instance_eval do
29
+ Scarpe::CCInstance.include Scarpe::ShoesSpecTest
30
+
31
+ Scarpe::CCInstance.instance.instance_eval do
50
32
  event_init
51
33
 
52
- on_heartbeat do
34
+ t_timeout = ENV["SCARPE_SSPEC_TIMEOUT"] || "30"
35
+ timeout(t_timeout.to_f) unless t_timeout.downcase == "none"
36
+
37
+ on_event(:next_heartbeat) do
53
38
  Minitest.run ARGV
54
39
 
55
- test_finished_no_results
56
- Scarpe::ShoesSpecTest.test_obj = nil
40
+ wait_after = ENV["SCARPE_SSPEC_TIMEOUT_WAIT_AFTER_TEST"]
41
+ if !(wait_after && wait_after.downcase != "n" && wait_after.downcase != "no")
42
+ shut_down_shoes_code
43
+ end
57
44
  end
58
45
  end
59
46
 
60
- test_class = Class.new(Scarpe::ShoesSpecTest)
47
+ test_class = Class.new(Minitest::Test)
48
+ test_class.include Scarpe::ShoesSpecTest
61
49
  Object.const_set(Scarpe::Components::StringHelpers.camelize(class_name), test_class)
62
50
  test_name = "test_" + test_name unless test_name.start_with?("test_")
63
51
  test_class.define_method(test_name) do
@@ -66,7 +54,6 @@ module Scarpe::Test
66
54
  end
67
55
  end
68
56
 
69
- # This is based on the CatsCradle proxies initially, but will diverge over time
70
57
  class Scarpe::ShoesSpecProxy
71
58
  attr_reader :obj
72
59
  attr_reader :linkable_id
@@ -113,17 +100,15 @@ end
113
100
 
114
101
  # When running ShoesSpec tests, we create a parent class for all of them
115
102
  # with the appropriate convenience methods and accessors.
116
- class Scarpe::ShoesSpecTest < Minitest::Test
103
+ module Scarpe::ShoesSpecTest
117
104
  include Scarpe::Test::HTMLAssertions
118
105
 
119
- class << self
120
- attr_accessor :test_obj
121
- end
122
106
  Shoes::Drawable.drawable_classes.each do |drawable_class|
123
107
  finder_name = drawable_class.dsl_name
124
108
 
125
109
  define_method(finder_name) do |*args|
126
- app = Shoes::App.instance
110
+ # Scarpe-Webview only supports a single Shoes::App instance
111
+ app = Shoes.APPS[0]
127
112
 
128
113
  drawables = app.find_drawables_by(drawable_class, *args)
129
114
  raise Shoes::Errors::MultipleDrawablesFoundError, "Found more than one #{finder_name} matching #{args.inspect}!" if drawables.size > 1
@@ -141,7 +126,7 @@ class Scarpe::ShoesSpecTest < Minitest::Test
141
126
  end
142
127
 
143
128
  def catscradle_dsl(&block)
144
- Scarpe::Test::CCInstance.instance.instance_eval(&block)
129
+ Scarpe::CCInstance.instance.instance_eval(&block)
145
130
  end
146
131
 
147
132
  def dom_html
@@ -151,30 +136,25 @@ class Scarpe::ShoesSpecTest < Minitest::Test
151
136
  end
152
137
  end
153
138
 
154
- # This isn't working. Neither is calling die_after. Are the other fibers not
155
- # running or something like that? Should run a test from the command line
156
- # and see what's happening... Or check logfiles?
157
- def timeout(t_timeout = 5.0, exit_code: -1)
139
+ # A timeout won't cause an error by itself. If you want an error, make sure
140
+ # to check for a minimum number of assertions or otherwise look for progress.
141
+ def timeout(t_timeout = 5.0)
158
142
  catscradle_dsl do
159
143
  t0 = Time.now
160
144
  on_event(:every_heartbeat) do
161
145
  if Time.now - t0 >= t_timeout
162
- if exit_code == 0
163
- @log.info "Timed out after #{t_timeout} seconds!"
164
- else
165
- @log.error "Timed out after #{t_timeout} seconds!"
166
- end
167
- exit exit_code
146
+ @log.info "Timed out after #{t_timeout} seconds!"
147
+ shut_down_shoes_code
168
148
  end
169
149
  end
170
150
  end
171
151
  end
172
152
 
173
- def exit_on_first_heartbeat(exit_code: 0)
153
+ def exit_on_first_heartbeat
174
154
  catscradle_dsl do
175
155
  on_event(:next_heartbeat) do
176
156
  @log.info "Exiting on first heartbeat (exit code #{exit_code})"
177
- exit exit_code
157
+ exit 0
178
158
  end
179
159
  end
180
160
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Scarpe
4
- VERSION = "0.3.0"
4
+ VERSION = "0.5.0"
5
5
  end
data/lib/scarpe/wv/app.rb CHANGED
@@ -55,6 +55,7 @@ module Scarpe::Webview
55
55
  end
56
56
 
57
57
  def run
58
+ # This is run before the Webview event loop is up and running
58
59
  @control_interface.dispatch_event(:init)
59
60
 
60
61
  @view.empty_page = empty_page_element
data/lib/scarpe/wv/arc.rb CHANGED
@@ -2,10 +2,6 @@
2
2
 
3
3
  module Scarpe::Webview
4
4
  class Arc < Drawable
5
- def initialize(properties)
6
- super(properties)
7
- end
8
-
9
5
  def element
10
6
  render("arc")
11
7
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Scarpe::Webview
4
+ class Border < Drawable
5
+
6
+ def initialize(properties)
7
+ super(properties)
8
+ end
9
+
10
+ # If the drawable is intended to be overridable, add element and style to Calzini instead
11
+ def element
12
+ render('border')
13
+ end
14
+ end
15
+ end
@@ -1,15 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # The ControlInterface is used for testing. It's a way to register interest
4
- # in important events like redraw, init and shutdown, and to configure a
5
- # Shoes app for testing. Note that no part of the Scarpe framework should
6
- # ever *depend* on ControlInterface. It's for testing, not normal operation.
7
- # If no ControlInterface were ever created or called, Scarpe apps should run
8
- # fine with no modifications.
9
- #
10
- # And if you depend on this from the framework, I'll add a check-mode that
11
- # never dispatches any events to any handlers. Do NOT test me on this.
12
-
3
+ # The ControlInterface is used to coordinate events. It's a way to register interest
4
+ # in important events like redraw, init and shutdown. It's used extensively for testing.
13
5
  module Scarpe::Webview
14
6
  class ControlInterface
15
7
  include Shoes::Log
@@ -16,12 +16,12 @@ module Scarpe::Webview
16
16
  when "font"
17
17
  @fonts << args[0]
18
18
  # Can't just create font_updater and alert_updater on initialize - not everything is set up
19
- @font_updater ||= Scarpe::Webview::WebWrangler::ElementWrangler.new("root-fonts")
19
+ @font_updater ||= Scarpe::Webview::WebWrangler::ElementWrangler.new(html_id: "root-fonts")
20
20
  @font_updater.inner_html = font_contents
21
21
  when "alert"
22
22
  bind_ok_event
23
23
  @alerts << args[0]
24
- @alert_updater ||= Scarpe::Webview::WebWrangler::ElementWrangler.new("root-alerts")
24
+ @alert_updater ||= Scarpe::Webview::WebWrangler::ElementWrangler.new(html_id: "root-alerts")
25
25
  @alert_updater.inner_html = alert_contents
26
26
  else
27
27
  raise Scarpe::UnknownBuiltinCommandError, "Unexpected builtin command: #{cmd_name.inspect}!"
@@ -42,7 +42,6 @@ module Scarpe::Webview
42
42
 
43
43
  @shoes_style_names = properties.keys.map(&:to_s) - ["shoes_linkable_id"]
44
44
 
45
- # Call method, which looks up the parent
46
45
  @shoes_linkable_id = properties["shoes_linkable_id"] || properties[:shoes_linkable_id]
47
46
  unless @shoes_linkable_id
48
47
  raise Scarpe::MissingAttributeError, "Could not find property shoes_linkable_id in #{properties.inspect}!"
@@ -58,6 +57,8 @@ module Scarpe::Webview
58
57
  # Must call this before bind
59
58
  super(linkable_id: @shoes_linkable_id)
60
59
 
60
+ # This will only be used if moving a drawable from one parent to another.
61
+ # Shoes doesn't normally do that.
61
62
  bind_shoes_event(event_name: "parent", target: shoes_linkable_id) do |new_parent_id|
62
63
  display_parent = DisplayService.instance.query_display_drawable_for(new_parent_id)
63
64
  if @parent != display_parent
@@ -101,9 +102,9 @@ module Scarpe::Webview
101
102
  if hidden
102
103
  html_element.set_style("display", "none")
103
104
  else
104
- new_style = style # Get current display CSS property, which may vary by subclass
105
- disp = new_style[:display]
106
- html_element.set_style("display", disp || "block")
105
+ # With Calzini we can't easily tell what the display property should be.
106
+ # Could be flex or inline, not only block or none. Re-render this drawable.
107
+ needs_update!
107
108
  end
108
109
  end
109
110
 
@@ -143,41 +144,6 @@ module Scarpe::Webview
143
144
  needs_update!
144
145
  end
145
146
 
146
- # Convert an [r, g, b, a] array to an HTML hex color code
147
- # Arrays support alpha. HTML hex does not. So premultiply.
148
- def rgb_to_hex(color)
149
- return color if color.nil?
150
-
151
- r, g, b, a = *color
152
- if r.is_a?(Float)
153
- a ||= 1.0
154
- r_float = r * a
155
- g_float = g * a
156
- b_float = b * a
157
- else
158
- a ||= 255
159
- a_float = (a / 255.0)
160
- r_float = (r.to_f / 255.0) * a_float
161
- g_float = (g.to_f / 255.0) * a_float
162
- b_float = (b.to_f / 255.0) * a_float
163
- end
164
-
165
- r_int = (r_float * 255.0).to_i.clamp(0, 255)
166
- g_int = (g_float * 255.0).to_i.clamp(0, 255)
167
- b_int = (b_float * 255.0).to_i.clamp(0, 255)
168
-
169
- "#%0.2X%0.2X%0.2X" % [r_int, g_int, b_int]
170
- end
171
-
172
- # CSS styles
173
- def style
174
- styles = {}
175
- if @hidden
176
- styles[:display] = "none"
177
- end
178
- styles
179
- end
180
-
181
147
  public
182
148
 
183
149
  # This gets an accessor for just this element's HTML ID.
@@ -187,7 +153,7 @@ module Scarpe::Webview
187
153
  #
188
154
  # @return [Scarpe::WebWrangler::ElementWrangler] a DOM object manager
189
155
  def html_element
190
- @elt_wrangler ||= Scarpe::Webview::WebWrangler::ElementWrangler.new(html_id)
156
+ @elt_wrangler ||= Scarpe::Webview::WebWrangler::ElementWrangler.new(html_id:)
191
157
  end
192
158
 
193
159
  # Return a promise that guarantees all currently-requested changes have completed
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Scarpe::Webview
4
4
  class EditBox < Drawable
5
- attr_reader :text, :height, :width
5
+ attr_reader :text, :height, :width, :tooltip , :font
6
6
 
7
7
  def initialize(properties)
8
8
  super
@@ -11,6 +11,9 @@ module Scarpe::Webview
11
11
  bind("change") do |new_text|
12
12
  send_self_event(new_text, event_name: "change")
13
13
  end
14
+ bind("hover") do
15
+ send_self_event(event_name: "hover")
16
+ end
14
17
  end
15
18
 
16
19
  def properties_changed(changes)
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Scarpe::Webview
4
4
  class EditLine < Drawable
5
- attr_reader :text, :width
5
+ attr_reader :text, :width, :stroke, :font, :tooltip, :secret
6
6
 
7
7
  def initialize(properties)
8
8
  super
@@ -11,6 +11,9 @@ module Scarpe::Webview
11
11
  bind("change") do |new_text|
12
12
  send_self_event(new_text, event_name: "change")
13
13
  end
14
+ bind("hover") do |new_text|
15
+ send_self_event(new_text, event_name: "hover")
16
+ end
14
17
  end
15
18
 
16
19
  def properties_changed(changes)
@@ -1,16 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "scarpe/components/base64"
4
-
5
3
  module Scarpe::Webview
6
4
  class Image < Drawable
7
- include Scarpe::Components::Base64
8
-
9
5
  def initialize(properties)
10
6
  super
11
7
 
12
8
  unless valid_url?(@url)
13
- @url = "data:image/png;base64,#{encode_file_to_base64(@url)}"
9
+ # It's assumed to be a file path.
10
+ @url = Scarpe::Webview.asset_server.asset_url(File.expand_path @url)
14
11
  end
15
12
  end
16
13
 
@@ -10,8 +10,10 @@ module Scarpe::Webview
10
10
  end
11
11
  end
12
12
 
13
- def element
14
- render "link"
13
+ def to_calzini_hash
14
+ h = super
15
+ h[:tag] = "a"
16
+ h
15
17
  end
16
18
  end
17
19
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Scarpe::Webview
4
+ class Oval < Drawable
5
+ def initialize(properties)
6
+ super(properties)
7
+ end
8
+
9
+ def element(&block)
10
+ render("oval", &block)
11
+ end
12
+ end
13
+ end
@@ -61,6 +61,7 @@ module Scarpe::Webview
61
61
  private
62
62
 
63
63
  def child_markup
64
+ # The children should be only text strings or TextDrawables.
64
65
  items_to_display_children(@text_items).map do |child|
65
66
  if child.respond_to?(:to_html)
66
67
  child.to_html
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This may or may not stay. It's basically an example extension. It can be done
4
+ # better, and there's no reason it should be specific to button.
5
+ Shoes::Button.shoes_style :html_class, feature: :html
6
+
7
+ # We have a number of real Scarpe extensions that need to be properly marked as such
8
+ # and moved in here. Padding is a great example, as is html_attributes.
@@ -2,13 +2,16 @@
2
2
 
3
3
  module Scarpe::Webview
4
4
  class Shape < Drawable
5
+ # Shape is the only (?) remaining drawable that doesn't use Calzini.
6
+ # It's also kind of broken - it doesn't do what a Shoes Shape is
7
+ # supposed to do yet. This can really use a rework at some point.
5
8
  def to_html
6
9
  @children ||= []
7
10
  child_markup = @children.map(&:to_html).join
8
11
 
9
12
  color = @draw_context["fill"] || "black"
10
13
  self_markup = HTML.render do |h|
11
- h.div(id: html_id, style: style) do
14
+ h.div(id: html_id, style: shape_style) do
12
15
  h.svg(width: "400", height: "500") do
13
16
  h.path(d: path_from_shape_commands, style: "fill:#{color};stroke-width:2;")
14
17
  end
@@ -22,7 +25,7 @@ module Scarpe::Webview
22
25
  def element(&block)
23
26
  color = @draw_context["fill"] || "black"
24
27
  HTML.render do |h|
25
- h.div(id: html_id, style: style) do
28
+ h.div(id: html_id, style: shape_style) do
26
29
  h.svg(width: "400", height: "500") do
27
30
  h.path(d: path_from_shape_commands, style: "fill:#{color};stroke-width:2;")
28
31
  end
@@ -55,11 +58,13 @@ module Scarpe::Webview
55
58
 
56
59
  protected
57
60
 
58
- def style
59
- super.merge({
61
+ def shape_style
62
+ s = {
60
63
  width: "400",
61
64
  height: "900",
62
- })
65
+ }
66
+ s[:display] = "none" if @hidden
67
+ s
63
68
  end
64
69
  end
65
70
  end
@@ -1,32 +1,90 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # There are different ways to implement these tags. You can change the HTML tag (link,
4
+ # code, strong) or set default values (del for strikethrough.) There's no reason the
5
+ # Shoes tag name has to match the HTML tag (del, link). This can be a little
6
+ # complicated since CSS often sets default values (e.g. del for strikethrough) and
7
+ # Scarpe may use those default values or override them. Long term it may be easier
8
+ # for us to set up our own CSS for this somehow that does *not* use the HTML-tag
9
+ # defaults since the browser can mess with those, and there's no guarantee that
10
+ # Webview uses the same default CSS style across all OSes.
11
+
3
12
  module Scarpe::Webview
13
+ # This class renders text tags like em, strong, link, etc.
4
14
  class TextDrawable < Drawable
5
- def to_html
6
- # Do not render TextDrawables with individual wrapper divs.
7
- element
15
+ # Calzini renders based on properties, mostly Shoes styles.
16
+ # To have Calzini render this for us, we convert to the format
17
+ # Calzini expects and then let it render. See Webview::Para
18
+ # for the specific Calzini call.
19
+ def to_calzini_hash
20
+ text_array = items_to_display_children(@text_items).map do |item|
21
+ if item.respond_to?(:to_calzini_hash)
22
+ item.to_calzini_hash
23
+ elsif item.is_a?(String)
24
+ item
25
+ else
26
+ # This should normally be filtered out in Lacci, long before we see it
27
+ raise "Unrecognized item in TextDrawable! #{item.inspect}"
28
+ end
29
+ end
30
+
31
+ {
32
+ items: text_array,
33
+ html_id: @linkable_id.to_s,
34
+ tag: nil, # have Calzini assign a default unless a subclass overrides this
35
+ props: shoes_styles,
36
+ }
37
+ end
38
+
39
+ def element
40
+ render("text_drawable", [to_calzini_hash])
41
+ end
42
+
43
+ def items_to_display_children(items)
44
+ return [] if items.nil?
45
+
46
+ items.map do |item|
47
+ if item.is_a?(String)
48
+ item
49
+ else
50
+ Scarpe::Webview::DisplayService.instance.query_display_drawable_for(item)
51
+ end
52
+ end
53
+ end
54
+
55
+ # Usually we query by ID, but for TextDrawable it has to be by class.
56
+ # That's how needs_update!, etc continue to work.
57
+ def html_element
58
+ @elt_wrangler ||= Scarpe::Webview::WebWrangler::ElementWrangler.new(selector: %{document.getElementsByClassName("id_#{html_id}")}, multi: true)
8
59
  end
9
60
  end
10
61
 
11
62
  class << self
12
- def default_wv_text_drawable_with(element)
13
- webview_class_name = element.capitalize
63
+ def default_wv_text_drawable_with_tag(shoes_tag, html_tag = nil)
64
+ html_tag ||= shoes_tag
65
+ webview_class_name = shoes_tag.capitalize
14
66
  webview_drawable_class = Class.new(Scarpe::Webview::TextDrawable) do
15
- def initialize(properties)
16
- class_name = self.class.name.split("::")[-1]
17
- @html_tag = class_name.delete_prefix("Webview").downcase
18
- super
67
+ class << self
68
+ attr_accessor :html_tag
19
69
  end
20
70
 
21
- def element
22
- render(@html_tag) { @content.to_s }
71
+ def to_calzini_hash
72
+ h = super
73
+ h[:tag] = self.class.html_tag
74
+ h
23
75
  end
24
76
  end
25
77
  Scarpe::Webview.const_set webview_class_name, webview_drawable_class
78
+ webview_drawable_class.html_tag = html_tag
26
79
  end
27
80
  end
28
81
  end
29
82
 
30
- Scarpe::Webview.default_wv_text_drawable_with(:code)
31
- Scarpe::Webview.default_wv_text_drawable_with(:em)
32
- Scarpe::Webview.default_wv_text_drawable_with(:strong)
83
+ Scarpe::Webview.default_wv_text_drawable_with_tag(:code)
84
+ Scarpe::Webview.default_wv_text_drawable_with_tag(:del)
85
+ Scarpe::Webview.default_wv_text_drawable_with_tag(:em)
86
+ Scarpe::Webview.default_wv_text_drawable_with_tag(:strong)
87
+ Scarpe::Webview.default_wv_text_drawable_with_tag(:span)
88
+ Scarpe::Webview.default_wv_text_drawable_with_tag(:sub)
89
+ Scarpe::Webview.default_wv_text_drawable_with_tag(:sup)
90
+ Scarpe::Webview.default_wv_text_drawable_with_tag(:ins, "span") # Styled in Shoes, not CSS
@@ -261,6 +261,7 @@ module Scarpe::Webview
261
261
  @log.debug("Scheduled JS: (#{this_eval_serial})\n#{wrapped_code}")
262
262
  else
263
263
  # We're mid-shutdown. No more scheduling things.
264
+ @log.warn "Mid-shutdown JS eval. Not scheduling JS!"
264
265
  end
265
266
  end
266
267
 
@@ -746,16 +747,37 @@ class Scarpe::Webview::WebWrangler
746
747
  class ElementWrangler
747
748
  attr_reader :html_id
748
749
 
749
- # Create an ElementWrangler for the given HTML ID
750
+ # Create an ElementWrangler for the given HTML ID or selector.
751
+ # The caller should provide exactly one of the html_id or selector.
750
752
  #
751
753
  # @param html_id [String] the HTML ID for the DOM element
752
- def initialize(html_id)
754
+ def initialize(html_id: nil, selector: nil, multi: false)
753
755
  @webwrangler = ::Scarpe::Webview::DisplayService.instance.wrangler
754
756
  raise Scarpe::MissingWranglerError, "Can't get WebWrangler!" unless @webwrangler
755
757
 
756
- @html_id = html_id
758
+ if html_id && !selector
759
+ @selector = "document.getElementById('" + html_id + "')"
760
+ elsif selector && !html_id
761
+ @selector = selector
762
+ else
763
+ raise ArgumentError, "Must provide exactly one of html_id or selector!"
764
+ end
765
+
766
+ @multi = multi
757
767
  end
758
768
 
769
+ private
770
+
771
+ def on_each(fragment)
772
+ if @multi
773
+ @webwrangler.dom_change("a = Array.from(#{@selector}); a.forEach((item) => item#{fragment}); true")
774
+ else
775
+ @webwrangler.dom_change(@selector + fragment + ";true")
776
+ end
777
+ end
778
+
779
+ public
780
+
759
781
  # Return a promise that will be fulfilled when all changes scheduled via
760
782
  # this ElementWrangler are verified complete.
761
783
  #
@@ -769,7 +791,7 @@ class Scarpe::Webview::WebWrangler
769
791
  # @param new_value [String] the new value
770
792
  # @return [Scarpe::Promise] a promise that will be fulfilled when the change is complete
771
793
  def value=(new_value)
772
- @webwrangler.dom_change("document.getElementById('" + html_id + "').value = `" + new_value + "`; true")
794
+ on_each(".value = `" + new_value + "`")
773
795
  end
774
796
 
775
797
  # Update the JS DOM element's inner_text. The given Ruby value will be converted to string and assigned in single-quotes.
@@ -777,7 +799,7 @@ class Scarpe::Webview::WebWrangler
777
799
  # @param new_text [String] the new inner_text
778
800
  # @return [Scarpe::Promise] a promise that will be fulfilled when the change is complete
779
801
  def inner_text=(new_text)
780
- @webwrangler.dom_change("document.getElementById('" + html_id + "').innerText = '" + new_text + "'; true")
802
+ on_each(".innerText = '" + new_text + "'")
781
803
  end
782
804
 
783
805
  # Update the JS DOM element's inner_html. The given Ruby value will be converted to string and assigned in backquotes.
@@ -785,7 +807,7 @@ class Scarpe::Webview::WebWrangler
785
807
  # @param new_html [String] the new inner_html
786
808
  # @return [Scarpe::Promise] a promise that will be fulfilled when the change is complete
787
809
  def inner_html=(new_html)
788
- @webwrangler.dom_change("document.getElementById(\"" + html_id + "\").innerHTML = `" + new_html + "`; true")
810
+ on_each(".innerHTML = `" + new_html + "`")
789
811
  end
790
812
 
791
813
  # Update the JS DOM element's outer_html. The given Ruby value will be converted to string and assigned in backquotes.
@@ -793,7 +815,7 @@ class Scarpe::Webview::WebWrangler
793
815
  # @param new_html [String] the new outer_html
794
816
  # @return [Scarpe::Promise] a promise that will be fulfilled when the change is complete
795
817
  def outer_html=(new_html)
796
- @webwrangler.dom_change("document.getElementById(\"" + html_id + "\").outerHTML = `" + new_html + "`; true")
818
+ on_each(".outerHTML = `" + new_html + "`")
797
819
  end
798
820
 
799
821
  # Update the JS DOM element's attribute. The given Ruby value will be inspected and assigned.
@@ -802,7 +824,7 @@ class Scarpe::Webview::WebWrangler
802
824
  # @param value [String] the new attribute value
803
825
  # @return [Scarpe::Promise] a promise that will be fulfilled when the change is complete
804
826
  def set_attribute(attribute, value)
805
- @webwrangler.dom_change("document.getElementById(\"" + html_id + "\").setAttribute(" + attribute.inspect + "," + value.inspect + "); true")
827
+ on_each(".setAttribute(" + attribute.inspect + "," + value.inspect + ")")
806
828
  end
807
829
 
808
830
  # Update an attribute of the JS DOM element's style. The given Ruby value will be inspected and assigned.
@@ -811,19 +833,19 @@ class Scarpe::Webview::WebWrangler
811
833
  # @param value [String] the new style attribute value
812
834
  # @return [Scarpe::Promise] a promise that will be fulfilled when the change is complete
813
835
  def set_style(style_attr, value)
814
- @webwrangler.dom_change("document.getElementById(\"" + html_id + "\").style.#{style_attr} = " + value.inspect + "; true")
836
+ on_each(".style.#{style_attr} = " + value.inspect + ";")
815
837
  end
816
838
 
817
839
  # Remove the specified DOM element
818
840
  #
819
841
  # @return [Scarpe::Promise] a promise that wil be fulfilled when the element is removed
820
842
  def remove
821
- @webwrangler.dom_change("document.getElementById('" + html_id + "').remove(); true")
843
+ on_each(".remove()")
822
844
  end
823
845
 
824
846
  def toggle_input_button(mark)
825
847
  checked_value = mark ? "true" : "false"
826
- @webwrangler.dom_change("document.getElementById('#{html_id}').checked = #{checked_value};")
848
+ on_each(".checked = #{checked_value}")
827
849
  end
828
850
  end
829
851
  end